I\'ve seen this a lot: $fp = fopen($filepath, \"w\") or die();
But I can\'t seem to find any real documentation on this \"or\" syntax. It\'s obvious enough what
It's a logical operator and can be used in any logical expression.
http://php.net/manual/en/language.operators.logical.php
This is neat trick, inherited from some PHP predecessor, based on the fact that PHP quite smartly won't evaluate any expression following OR, if first one returned true:
function a($ret){
echo "FOO";
return $ret;
}
function b($ret){
echo "BAR";
return $ret;
}
$result = (a(true) OR b(true));
will print out only FOO
, means b() weren't even executed.