Posted by Rik on 04/29/06 07:42
jenngra@gmail.com wrote:
> Hi, I want to only pass 8 digit long numbers, everything else should
> fail. How is that expressed? Best regards, Jennifer
If there are no leading zeroes:
(int)$number;
if($number >9999999&&$number<100000000) $pass=true;
OR
if(is_integer($number)&&strlen($number)==8) $pass=true;
If leading zeroes are possible:
if(preg_match("/^[0-9]{8}$/Am",$number)==1) $pass = true;
Grtz,
--
Rik Wasmus
[Back to original message]
|