"Guard" operator like JavaScript in PHP -
i in javascript:
function (a, b, c) { var foo = || b || c; return foo.bar; }
is there quick way assignment fallback or require custom function
?
php 5.3 introduces ?:
operator (not confused ternary conditional, go figure). don't use php, imagine it'd like:
$foo = $a ?: $b ?: $c
see: http://php.net/manual/en/language.operators.comparison.php
since php 5.3, possible leave out middle part of ternary operator. expression expr1 ?: expr3 returns expr1 if expr1 evaluates true, , expr3 otherwise.
happy coding.
Comments
Post a Comment