Kim Steinhaug wrote:

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"))
  ) {
    // Here we do nothing
     } else {
    // This is where we do it
    }

Wouldn't it then be like this?


if($_GET['id']!=1 && $_GET['mode']!='home' && (isset($_GET['item']) && $_GET['mode']!='news'))
// Do stuff.


I may be wrong though. Note that I used AND instead of OR for the conditions, because you want them all true at the same time. But then again, you'd have to test it, with so many conditions it becomes a bit difficult to picture it in my head :P

HIH,
Anguz

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



Reply via email to