I would like to test wether a $_POST var is an integer or not. What is the best way?

I ahve tried is_int() but that fails b/c $_POST vars are always strings. is_numeric() doesn't help because it doesn't differentiate bewteen numbers (1.0) and integers (1).

The best I have been able to come up with is:

if (is_numeric($var) && is_int((int)$var))

But I ma hoping there is something simpler ...

Any ideas?

thansk,

Jean-Christian Imbeault


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



Reply via email to