Re: checking a string for numbers
| From: | CPT John W. Holmes | Date: | Thu, 26 Jun 2003 12:09:48 +0000 |
| Subject: | Re: checking a string for numbers | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28898@lists.php.net to get a copy of this message | ||
From: "Jamie Saunders" <phpdev@mediacdcards.net>
> I'm trying to find a way of simply checking a string for numbers.
>
> e.g.
>
> if ($myVar contains a number)
> {
> //numbers present
> }
> else
> {
> //no numbers present
> }
if(preg_match('/[0-9]/',$myVar))
{
//number present
}
else
{
//no numbers present
}
---John Holmes...