note 85784 added to function.ctype-digit
| From: | matt at doodoostyle dot com | Date: | Wed, 17 Sep 2008 18:07:49 +0000 |
| Subject: | note 85784 added to function.ctype-digit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144486@lists.php.net to get a copy of this message | ||
An interesting result I get on one of my systems...
WinXP SP3, Apache 2.2.8, PHP 5.2.5 and 5.2.6 ( identical results )
<?php
error_reporting( E_ALL );
$digit = 12345;
var_dump( ctype_digit(12345) );
var_dump( ctype_digit($digit) );
var_dump( $digit );
?>
Returns
bool(true)
bool(true)
int(12345)
From what I gather, ctype_digit should return FALSE with an integral argument. This may be due to a
newer version of the function performing the typecasting internally? Regardless, for compatibility
purposes I still suggest typecasting any variables you feed into this function.
ctype_digit( (string)$digit );
Interesting this change isn't noted in the manual.
----
Server IP: 64.71.164.2
Probable Submitter: 204.244.82.10
----
Manual Page -- http://www.php.net/manual/en/function.ctype-digit.php
Edit -- https://master.php.net/note/edit/85784
Del: integrated -- https://master.php.net/note/delete/85784/integrated
Del: useless -- https://master.php.net/note/delete/85784/useless
Del: bad code -- https://master.php.net/note/delete/85784/bad+code
Del: spam -- https://master.php.net/note/delete/85784/spam
Del: non-english -- https://master.php.net/note/delete/85784/non-english
Del: in docs -- https://master.php.net/note/delete/85784/in+docs
Del: other reasons-- https://master.php.net/note/delete/85784
Reject -- https://master.php.net/note/reject/85784
Search -- https://master.php.net/manage/user-notes.php