note 61290 deleted from function.intval by cmb

From: Date: Sun, 16 Feb 2020 13:48:31 +0000
Subject: note 61290 deleted from function.intval by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-214140@lists.php.net to get a copy of this message
Note Submitter: simon at npkk dot cz ---- intval() returns maxint on number_in_string, if the result would be bigger than it. But for float returns the signed 32 bit integer with the "same" value: <?php $num=-1000; print($num."\n"); $i_str=sprintf("%u",$num); print($i_str."\n"); $i1=intval($i_str); print($i1."\n"); $i2=intval(floatval($i_str)); print($i2."\n"); ?> prints: -1000 4294966296 2147483647 -1000

« previous php.notes (#214140) next »