Re: variable type - conversion/checking
| From: | Andrew Ballard | Date: | Sat, 16 Mar 2013 01:49:31 +0000 |
| Subject: | Re: variable type - conversion/checking | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320598@lists.php.net to get a copy of this message | ||
I suppose one could try something like this:
if (is_string($val) && $val === (string)(int)$val) ....
If $val is an integer masquerading as a string, it should be identical to
the original string when cast back to a string, shouldn't it? (I can't try
it right now.)
Andrew