Re: FILTER_VALIDATE_INT - newbie question
| From: | Ben Dunlap | Date: | Wed, 07 Oct 2009 17:45:50 +0000 |
| Subject: | Re: FILTER_VALIDATE_INT - newbie question | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298740@lists.php.net to get a copy of this message | ||
> How is 0342352 being assigned to the variable that you're filtering?
> If PHP thinks it's a string, then the filter will fail. If PHP thinks
Oops, potentially bad information there as well, sorry. In general, a
string representation of a decimal number /will/ pass
FILTER_VALIDATE_INT. But your particular string ("0342352") will only
fail FILTER_VALIDATE_INT in the filter's default configuration; set
the ALLOW_OCTAL flag and it will pass:
http://codepad.org/RNE5LZMr
You'll still end up with an unexpected value in your final variable, though.
Ben