note 119344 deleted from function.ctype-digit by cmb
| From: | cmb@php.net | Date: | Tue, 24 May 2016 13:41:54 +0000 |
| Subject: | note 119344 deleted from function.ctype-digit by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205569@lists.php.net to get a copy of this message | ||
Note Submitter: Joey
----
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.