Skip to main content

str_to_int

Function str_to_int 

Source
pub fn str_to_int(s: &[u8]) -> i64
Expand description

(int) $string / intval($string) (_is_numeric_string_ex with errors allowed): the leading integer or float after optional whitespace; floats and integers beyond i64 saturate, non-finite floats are 0; no number is 0.

Quirk kept from PHP 8.5: for a 19-digit integer followed by e+/e- and no exponent digit, PHP compares the wrong digits against PHP_INT_MIN’s, so "9223372036854775808e+" is PHP_INT_MIN.