note 119344 added to function.ctype-digit
| From: | Joey | Date: | Tue, 17 May 2016 14:08:01 +0000 |
| Subject: | note 119344 added to function.ctype-digit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205501@lists.php.net to get a copy of this message | ||
In php5.6, if you pass an int/long to dtype_digit it will try to do clever stuff like treat it as a
char (5 => chr(5)) or use convert_to_string.
I suspect this means that -128..255 is false except 48 to 57.
Oh and I think higher number outside that range are true because of convert to string.
My advice, just don't send longs to ctype_digit unless you want to check they are ASCII 0-9
codes.
This combination of behaviours defies logic, probably why it's not documented.
I hope php 7 strips it out.
----
Server IP: 72.52.91.14
Probable Submitter: 149.6.187.130
----
Manual Page -- http://php.net/manual/en/function.ctype-digit.php
Edit -- https://master.php.net/note/edit/119344
Del: integrated -- https://master.php.net/note/delete/119344/integrated
Del: useless -- https://master.php.net/note/delete/119344/useless
Del: bad code -- https://master.php.net/note/delete/119344/bad+code
Del: spam -- https://master.php.net/note/delete/119344/spam
Del: non-english -- https://master.php.net/note/delete/119344/non-english
Del: in docs -- https://master.php.net/note/delete/119344/in+docs
Del: other reasons-- https://master.php.net/note/delete/119344
Reject -- https://master.php.net/note/reject/119344
Search -- https://master.php.net/manage/user-notes.php