Possible Duplicate:
PHP short circuit lazy evaluation, where is it in the php.net manual?
PHP “or” Syntax
I have seen people using the || operator as program flow control as follows:
function() || die("message");
where die("message"); will run if function() returns false. Furthermore, it seems to only work for die(); and exit(); else the interpreter will throw a "syntax error" message.
I'm wondering what this is called and where can I find documentation for its behaviour.
mysql_select_db($database, $connection) || die(mysql_error()) ;foo() || bar(). There's no special treatment ofexitordie.dieandexit. It works for expressions (where function calls are one option). Commonlyoris preferred over||however.