if (($var!=0) && ($var*1!=0) && is_int($var*1))
{
        echo "is int";
        $var=$var*1;
}
else
{
        echo "is not int";
        $var=1;
}

Works for me because I need an integer greater than 0.  Try it out and let
me know any problems with it.

- seb

-----Original Message-----
From: Philip Olson [mailto:[EMAIL PROTECTED]]
Sent: 28 August 2001 22:44
To: [EMAIL PROTECTED]
Subject: [PHP] is_numeric for php3


hi friends,

Can someone post here "the" most efficient method to validate a variable
as numeric?  I see a ton of hacks/ways in the manual user comments under
is_int, is_integer and is_numeric and would like to see just one or two
good solid ones.  And please, no regular expressions :)

Regards,
Philip




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to