Page 1 of 1

number of 5 digits?

Posted: Sun Jun 27, 2004 12:58 pm
by ddragas
how can I check if variable is number of 5 digits?

Posted: Sun Jun 27, 2004 1:01 pm
by Deemo
if its an integer, you could use is_int() followed by strlen()

Posted: Sun Jun 27, 2004 1:09 pm
by feyd

Code: Select all

echo (preg_match('#^\d{5}$#',$value)?'yes':'no');

Posted: Mon Jun 28, 2004 5:28 am
by Grim...
Feyd, I truely believe you have the ablility to do anything with a preg_* statement.
Can you write me one that turns water into lager for me?

Posted: Mon Jun 28, 2004 12:17 pm
by feyd
[offtopic]

Code: Select all

$now_with_beer = preg_replace('#\bwater\b#i',"[i]your favorite fermented beverage 'ere[/i]",$without_beer);
:P