you should use preg_match

if (preg_match("/\d/",$myVar)){
        echo "yes it contains a digit";
}


i believe this works... you should use preg_match  and with \d it checks for
a digit

i'm not sure this works...

let me know



-----Original Message-----
From: Jamie Saunders [mailto:[EMAIL PROTECTED]
Sent: donderdag 26 juni 2003 13:05
To: [EMAIL PROTECTED]
Subject: [PHP-DB] checking a string for numbers


Hi,

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
}

Thanks,

-- 
Jamie Saunders
Media Architect
[EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to