I like to do this in JavaScript:
function (a, b, c) {
var foo = a || b || c;
return foo.bar;
}
Is there a quick way to do assignmen
PHP 5.3 introduces the ?:
operator (not to be confused with the ternary conditional, go figure). I don't use PHP, but I imagine it'd be something like:
$foo = $a ?: $b ?: $c
See: http://php.net/manual/en/language.operators.comparison.php
Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise.
Happy coding.