[thelist] PHP: is_numeric... that's the question...
tim
tim at hyperlinkage.com
Thu Jan 18 13:03:28 CST 2007
Tris wrote:
> return preg_match("/\d{1,8}/", is_numeric($usercode));
> still doesn't work, I can enter a numeric string of 9 or more
> characters and it's accepted? yet the {1,8} should stop at 8
> characters right???
return preg_match( "/^\d{1,8}$/", $usercode );
The ^ and $ characters match the start and end of a string, thus the
match will fail if there are any additional characters in your string.
Note I also used these in my earlier post to restrict the string to 2
letters, 5 numbers, and nothing else.
Tim
--
http://www.hyperlinkage.com/
More information about the thelist
mailing list