Re: checking a string for numbers

From: Date: Thu, 26 Jun 2003 11:38:26 +0000
Subject: Re: checking a string for numbers
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-28896@lists.php.net to get a copy of this message
$extract = preg_replace( "/[^0-9]/", "", $str ) // will extract the figures from your string HTH Ignatius _________________________ ----- Original Message ----- From: "Jamie Saunders" <phpdev@mediacdcards.net> To: <php-db@lists.php.net> Sent: Thursday, June 26, 2003 1:04 PM 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 > phpdev@mediacdcards.net > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#28896) next »