RE: [PHP] is_numeric for php3
| From: | Seb Frost | Date: | Wed, 29 Aug 2001 00:11:28 +0000 |
| Subject: | RE: [PHP] is_numeric for php3 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64921@lists.php.net to get a copy of this message | ||
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:philip@cornado.com]
Sent: 28 August 2001 22:44
To: php-general@lists.php.net
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: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
---
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