* Thus wrote Kim Steinhaug ([EMAIL PROTECTED]): > Often I end up using a "dumb" IF statement which to me seems that > it could have been done some other way. > > Example : > if( > ($_GET["id"]==1) or > ($_GET["mode"]=="home") or > ((!isset($_GET["item"])) && ($_GET["mode"]=="news"))
For starters, don't intermatch 'OR' with &&, the have different precedence's and can lead to unexpected behaviour. The proper 'OR' that should be used is ||. see: http://php.net/operators Here is an approach I use to avoid making the if statement real complicated and kinda makes it more understandable what you are trying to accomplish with the condition: $is_ok = $_GET["id"] == 1 || $_GET["mode"] == "home" || (!isset($_GET["item"]) && $_GET["mode"] == "news")); if (! is_ok ) { // yada... } Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php