Re: variable type - conversion/checking
| From: | Ashley Sheridan | Date: | Sat, 16 Mar 2013 10:19:30 +0000 |
| Subject: | Re: variable type - conversion/checking | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320607@lists.php.net to get a copy of this message | ||
On Fri, 2013-03-15 at 22:32 -0400, Andrew Ballard wrote:
> > Guess regex are the only useful solution here. When you consider to use
> > built-in functions, just remember, that for example '0xAF' is an integer
> > too, but '42.00' isn't.
>
> Shoot...I hadn't considered how PHP might handle hex or octal strings when
> casting to int. (Again, not in front of a computer where I can test it
> right now. )
>
> Regexes have problems with more than 9 digits for 32-bit ints. I guess to
> some degree it depends on how likely you are to experience values that
> large.
>
> Andrew
Do they? Regex's deal with strings, so I don't see why they should have
such issues. I've certainly never come across that problem, or heard of
it before.
Thanks,
Ash
http://www.ashleysheridan.co.uk