On Thursday, July 17, 2003, at 12:17 AM, Curt Zirzow wrote:
Excellent point! I find my self using regex's a bit to often when there
are other solutions available.
btw, have you ever tested the difference between
if(ereg('^[0-9]{6}$',$str))
if(preg_grep('^[0-9]{6}$',$str))
I've be
Justin French <[EMAIL PROTECTED]> wrote:
> If you care about performance at all, try and find away around the
> problem without regular expressions...
>
> I tested
>
> if( (strlen($str) == 6) && (is_int($str)) )
>
I did some more tests on this problem is that $str is still considered a
st
Yes, use preg_match("/^[0-9]{6}$/",$str) since it takes care of both
number and length.
You dont want to you is_numeric(), because that will match "4e5", etc..etc..
Brent Baisley wrote:
I'm pretty sure there will be a problem with using the is_int()
function. A similar problem was discussed a f
Ford, Mike [LSS] <[EMAIL PROTECTED]> wrote:
> > -Original Message-
> > From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> > Sent: 16 July 2003 15:17
> >
> > Justin French <[EMAIL PROTECTED]> wrote:
> > > If you care about performance at all, try and find away around the
> > > pro
Brent Baisley <[EMAIL PROTECTED]> wrote:
> I'm pretty sure there will be a problem with using the is_int()
> function. A similar problem was discussed a few weeks ago on this list
> and is_int() will return true for a "number" like 1000e2. The "e" being
> treated as an exponential representation
I'm pretty sure there will be a problem with using the is_int()
function. A similar problem was discussed a few weeks ago on this list
and is_int() will return true for a "number" like 1000e2. The "e" being
treated as an exponential representation of an integer.
It might be more reliable to add
> -Original Message-
> From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> Sent: 16 July 2003 15:17
>
> Justin French <[EMAIL PROTECTED]> wrote:
> > If you care about performance at all, try and find away around the
> > problem without regular expressions...
> >
> > I tested
> >
> > if( (
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Excellent point! I find my self using regex's a bit to often when there
> are other solutions available.
>
> btw, have you ever tested the difference between
>
> if(ereg('^[0-9]{6}$',$str))
> if(preg_grep('^[0-9]{6}$',$st
Justin French <[EMAIL PROTECTED]> wrote:
> If you care about performance at all, try and find away around the
> problem without regular expressions...
>
> I tested
>
> if( (strlen($str) == 6) && (is_int($str)) )
>
> vs
>
> if(ereg('^[0-9]{6}$',$str))
>
>
> ...on my LAN test serve
If you care about performance at all, try and find away around the
problem without regular expressions...
I tested
if( (strlen($str) == 6) && (is_int($str)) )
vs
if(ereg('^[0-9]{6}$',$str))
...on my LAN test server with 10 iterations, and the regexp was
nearly 2 times slower than the f
if(!ereg('^[0-9]{6}$',$string) die('not six numbers');
you might want to trim off white space first.
Ron Allen wrote:
I would like to know how to verify that there are 6 numbers (only numbers in
a field)
that will be submitted to a database? Any clues!
--
PHP General Mailing List (http://ww
I would like to know how to verify that there are 6 numbers (only numbers in
a field)
that will be submitted to a database? Any clues!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
12 matches
Mail list logo