Re: expressions

From: Date: Sat, 27 Jan 2001 03:15:07 +0000
Subject: Re: expressions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36949@lists.php.net to get a copy of this message
> if ($co_area != !ereg("([0-9]{3})",$co_area)) > { echo " * Area code must be 3 digital"; } I don't know anything about ereg and regex, so if there's an error in that part I won't be able to help with that, but I can tell you that ($something != !$something_else) is a double negative, it's like saying "I can't not program in PHP." You might as well say ($something == $something_else), save the obfuscation factor. Since you want to do something when ereg is false, you should say: if (!ereg(...)) { Do a bunch of stuff; }

« previous php.general (#36949) next »