Re: I lied, another question / problem
| From: | Roman Neuhauser | Date: | Wed, 17 Jan 2007 09:43:57 +0000 |
| Subject: | Re: I lied, another question / problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-247199@lists.php.net to get a copy of this message | ||
# jochem@iamjochem.com / 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