[PHP] Number checker

2002-04-18 Thread Jeroen Timmers
i want to check if a given string has only numbers for exampl $test = "343124312" TRUE $test1 = "q34daf23423" FALSE Jeoren -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Number checker

2002-04-18 Thread Erik Price
On Thursday, April 18, 2002, at 02:58 PM, Jeroen Timmers wrote: > i want to check if a given string has only numbers > > for exampl > > $test = "343124312" TRUE > $test1 = "q34daf23423" FALSE use either is_numeric(), or for whole numbers only, use a regex: preg_match('/^\d+$/', $test); --

Re: [PHP] Number checker

2002-04-18 Thread Robert Cummings
Jeroen Timmers wrote: > > i want to check if a given string has only numbers > > for exampl > > $test = "343124312" TRUE > $test1 = "q34daf23423" FALSE I'm tempted to say "go read about ereg(), but since it's just as long to provide a response... return ereg( '^[[:alpha:]]*$', $testString );

Re: [PHP] Number checker

2002-04-18 Thread Robert Cummings
Robert Cummings wrote: > > Jeroen Timmers wrote: > > > > i want to check if a given string has only numbers > > > > for exampl > > > > $test = "343124312" TRUE > > $test1 = "q34daf23423" FALSE > > I'm tempted to say "go read about ereg(), but since it's > just as long to provide a response... >

Re: [PHP] Number checker

2002-04-18 Thread Philip Olson
use is_numeric() http://uk.php.net/is_numeric -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php