> Felipe Desiderati wrote:
> > try this:
> >
> > if (ereg("^[0-9]+$", $_POST["var_int"))
> >     echo "is int";
>
> That's not the best regexp. It doesn' take into account negative
> integers and isn't there a [[:numeric:]] or something like regexp that
> would work better.
>
> I'm looking for the simplest method and the one that takes the less
> processing power :)
>
> Calling up the regular expression engine dounds pretty processing
> intensive ...

Sorry, I don´t know that you needed an effective snipet. And you are right,
I only writed for positive integers. Try something like apply 2 type cast
simunltaneous.

if ( (string) ((int) $_POST["var_int"]) == $_POST["var_int"])
    echo "is int";

And sorry for my english,

[]´s Felipe


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

Reply via email to