Bug #3465 Updated: erroneous comparison of intval() return value

From: Date: Sat, 12 Feb 2000 06:32:28 +0000
Subject: Bug #3465 Updated: erroneous comparison of intval() return value
Groups: php.dev 
Request: Send a blank email to php-dev+get-15420@lists.php.net to get a copy of this message
ID: 3465 Updated by: torben Reported By: zeekamotay@hotmail.com Status: Closed Bug Type: Other Assigned To: Comments: This is not a bug; it's a result of the way PHP automatically changes a variable's type depending on context. For a full discussion of this, check out http://www.php.net/manual/language.types.type-juggling.php3 and http://www.php.net/manual/language.types.string.php3#LANGUAGE.TYPES.STRING.CONVERSION The upshot is that if $x contains any string not starting with numeric digits, it will be evaluated as '0' when referred to as an integer. Therefore both the $x and the intval($x) in the comparison shown evaluate to 0, and therefore the test returns true. Full Bug description available at: http://bugs.php.net/?id=3465

« previous php.dev (#15420) next »