Re: ereg-digits only...

From: Date: Tue, 12 Feb 2002 14:12:09 +0000
Subject: Re: ereg-digits only...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-84388@lists.php.net to get a copy of this message
as a said before i'm not sure; my idea was to use type casting instead of eregi; anyone can develop it into smart solution; i am out of time now for this developing so can suggest idea only Valentin Petruchek (aki Zliy Pes) *** cUT THE BEGINNING *** http://zliypes.com.ua mailto:val@zliypes.com.ua ----- Original Message ----- From: "Daniel Kushner" <php@websapp.com> To: <petruchek@zsu.zp.ua>; <b.verbeek@creative-edge.nl> Cc: "PHP" <php-general@lists.php.net> Sent: Tuesday, February 12, 2002 4:00 PM Subject: RE: [PHP] ereg-digits only... > That wouldn't work! > 1) You meant to write: if (((int)$string==$string) && ($string>0)) > > 2) (int)'5a' == 5, so this formula would result is 5a == 5! > > --Daniel > > > > -----Original Message----- > > From: val petruchek [mailto:petruchek@zsu.zp.ua] > > Sent: Tuesday, February 12, 2002 6:22 AM > > To: b.verbeek@creative-edge.nl > > Cc: PHP > > Subject: Re: [PHP] ereg-digits only... > > > > > > 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 > > > > > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#84388) next »