Re: Number checker
| From: | Robert Cummings | Date: | Thu, 18 Apr 2002 19:11:29 +0000 |
| Subject: | Re: Number checker | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93588@lists.php.net to get a copy of this message | ||
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...
>
> return ereg( '^[[:alpha:]]*$', $testString );
I should kick myself...
return ereg( '^[[:digit:]]*$', $testString );
Cheers,
Rob.
--
.-----------------.
| Robert Cummings |
:-----------------`----------------------------.
| Webdeployer - Chief PHP and Java Programmer |
:----------------------------------------------:
| Mail : mailto:robert.cummings@webmotion.com |
| Phone : (613) 731-4046 x.109 |
:----------------------------------------------:
| Website : http://www.webmotion.com |
| Fax : (613) 260-9545 |
`----------------------------------------------'