> can you please give an example where 'or die()' is 'not flexible'.

I am referring to 'or' specifically.  For example:

$conn = mysql_connect($host, $user, $pass) or die('Connection failed');

Okay that works.  But let's say one wants to do multiple statements on
failure, the following will not work:

$conn = mysql_connect($host, $user, $pass) or {
          doSomething();
          die('Connection failed');
}

So later down the road when Sammy wants to doSomething() he'll need to
alter the whole statement.  Instead, here's another way:

if (!$conn = mysql_connect($host, $user, $pass)) {
    doSomething();
    echo 'print stuff';
    exit;
}

Or if (!$conn)...  That is why I disagree with 'or' being a 'standard'
here.  Are there ways around it?  Yes.  Is the above just an example?  
Yep.  IMHO :)

Regards,
Philip Olson




Reply via email to