[thelist] PHP: is_numeric... that's the question...

Tris beertastic at gmail.com
Thu Jan 18 08:15:21 CST 2007


True...
I've just heard from a VB minded pal of mine.. and he said much the same thing..
On to the next one.. 14 more to go!! ;-p

Cheers everyone for all your help!!


On 18/01/07, Drew Trusz <drew.trusz at gmail.com> wrote:
> On 1/18/07, Tris <beertastic at gmail.com> wrote:
> > Indeed..
> > so using this:
> > return preg_match("/\d{1,8}/", is_numeric($usercode));
> > still doesn't work, I can enter a numeric string of 9 or more
> > characters and it's accepted? yet the {1,8} should stop at 8
> > characters right???
> >
> > OHHHH, It IS finding strings of 8 characters within the whole string...
> >
> > I started with this code:
> > =======================
> >         $codeLength = strlen($usercode);
> >         $codeInt = is_numeric($usercode);
> >         if ((($codeLength == 0) || ($codeLength > 8)) || (!$codeInt)) {
> >                 return false;
> >         } else {
> >                 return true;
> >         }
> > =======================
> >
> > Should I just stick to that, or is there a way to do it with one line
> > and regular expresions?
> >
> > Sigh...
> > is it Friday yet?
> >
> >
> >
> To borrow from Perl -- TIMTOWTDI (There Is More Than One Way To Do It)
>
> Or, if it ain't broke, don't fix it.
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>


-- 
When a person can no longer laugh at himself, it is time for others to
laugh at him.
Thomas Szasz



More information about the thelist mailing list