Re: ereg-digits only...
| From: | val petruchek | Date: | Tue, 12 Feb 2002 11:22:29 +0000 |
| Subject: | Re: ereg-digits only... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84382@lists.php.net to get a copy of this message | ||
if ((int($string)==($string)) && ($string>0)) {then positive integer}
not sure exactly, but try
Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:val@zliypes.com.ua
----- Original Message -----
From: "B. Verbeek" <b.verbeek@creative-edge.nl>
To: "Php-Db-Help (E-mail)" <php-db@lists.php.net>; "Php-General (E-mail)"
<php-general@lists.php.net>
Sent: Tuesday, February 12, 2002 1:04 PM
Subject: [PHP] ereg-digits only...
>
> 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
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>