On Tue, 2002-02-12 at 03:04, B. Verbeek wrote:
>
> How do I check a string for it to only contain numbers?
>
> >>
>
> if(!ereg("([0-9]+)",$string)){
>
> print "It contains characters other than numbers";
>
> }else{
>
> print "Only numbers";
>
> }
>
> <<
>
> Can anyone give some feedback...
>
> regards,
> Bart
Sure, try is_numeric():
http://www.php.net/is_numeric
Hope this helps,
Torben
--
Torben Wilson <[EMAIL PROTECTED]>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php