# [EMAIL PROTECTED] / 2007-01-17 01:42:09 +0100:
> Beauford wrote:
> > Further to my previous email, there is something weird going on here. I just
> > tried using this:
> > 
> >     if (!ereg('^[A-Za-z0-9]', $strvalue)) {
> >              return "error";
> >     }
> 
> stop using bleeding ereg*() function - move to preg_*() funcs like the rest of
> the world did 5+ years ago.

Or even better: how about using the right tool for the job? :)

    if (!ctype_isalnum($strvalue)) {
        return "error";
    }

>       if (!preg_match("#^[A-Z0-9]+\$#i", $s)) {

> (ps the above is a crappy regexp for real world use imho, but it serves
> the purpose of example)
 
It's dangerous.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to