|
Bug in PHP's ctype_digit()I recently encountered a bug in PHP's function The bug is that if you call The bug is apparent in the two versions of PHP I'm using, 4.3.10 and 4.3.11. I'm not sure from this bug report if any versions of PHP 4 have had this fixed. Provided you have a version of PHP that has not had this error fixed, the bug can be seen by running the following PHP snippet: <?php
$i = 99999;
var_dump($i);
ctype_digit($i);
var_dump($i);
?>
Output: int(99999)
NULL
As mentioned, embedding the integer in a string solves the problem: <?php
$i = 99999;
var_dump($i);
ctype_digit("$i");
var_dump($i);
?>
Output: int(99999)
int(99999)
|
