note 11894 added to function.preg-match.php
| From: | kferron at tm dot net | Date: | Mon, 12 Mar 2001 16:59:34 +0000 |
| Subject: | note 11894 added to function.preg-match.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12301@lists.php.net to get a copy of this message | ||
To check for digits:
<?php
if (!preg_match ("/[0-9]+/", $checkthis))
{
echo("contains no digits");
}
elseif (preg_match ("/^[0-9]+$/", $checkthis))
{
echo("only contains digits");
}
else {
echo("most likely contains digits and letters");
}
?>
________
phool
http://www.php.net/manual/en/function.preg-match.php