Skip to main content

to_php_int

Function to_php_int 

Source
pub fn to_php_int(value: &PhpValue) -> i64
Expand description

(int) $value (PHP 8.5, 64-bit): null and false 0, true 1; arrays 0 when empty, else 1; objects 1. A PhpValue::Ref is an unresolved back-reference and reads as null, 0; an object reference is 1.

A float truncates toward zero; NaN and the infinities are 0, and a finite float outside the int range wraps modulo 2^64 (zend_dval_to_lval()). A string reads its leading numeric prefix after leading whitespace (space, \t, \n, \r, \v, \f): a sign, digits, a fraction and an exponent ("12abc" 12, "1e3" 1000, "abc" 0). An integer prefix outside the range saturates; a float prefix truncates and saturates, except an infinite one ("1e999"), which is 0.