Re: ereg-digits only...
| From: | * R&zE: | Date: | Tue, 12 Feb 2002 11:37:41 +0000 |
| Subject: | Re: ereg-digits only... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84384@lists.php.net to get a copy of this message | ||
> if ((int($string)==($string)) && ($string>0)) {then positive integer}
>
> not sure exactly, but try
Why not use the RE's? I usually use preg_* so I'll give the example
using these...
if (preg_match ("/^\d+$/", $string)) {
print ("Yep... Only digits.");
} else {
prnt ("Noop! There are non-digit characters...");
}
--
* R&zE:
-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: renze@datalink.nl
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««