RE: FILTER_VALIDATE_INT - newbie question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Well, it was only a guess, but if you look at the integer limit on 32-bit systems, you'll see that the upper limit > for numbers is 2147483647 (or 2^31-1) which would explain maybe your upper limit problem.
>
> Also, I think you're getting confused over the zero with exactly what you are asking PHP to do. filter_var() returns > true if the filter matches. If the 0 match is returned as a false, then filter_var() will return false. You're then > inverting that with a !, all of which is inside an if() statement. Essentially this would mean that if the filter > returns false then the instructions inside of the if statement are carried out.


I always thought that that was a limit of the number of digits an integer value could have, and not the actually int value... I guess I was wrong. :s

You are right, I've tested with: 
2147483647 
it worked.

I've tested with:
2147483648
It displays the error.

"you're getting confused over the zero with exactly what you are asking PHP to do"
Absolutely... :(

If I put 0 filter_var() will return false.
If I put 0342352 filter_var() will also return false.

Could we say that: if it is indeed the fact, that filter_var() returns false when it finds a 0 at the beginning of a given number...

	"then the instructions inside of the if statement are carried out."

And here may be the reason for displaying the error message when we have the 0 leading a number.

And my point was exactly here
"If the 0 match is returned as a false" 

Why should filter_var() do something like this? Should the filter_var() interpretate 0 as a number without boolean semantic value?


Please be patient... 
Regards,
Márcio


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux