How can I do this in php? or or and return a boolean;
var a = 0, b = 3, с = a||b; alert(с); // 3
I.e
a ? a : b -> a||b
How can I do this in php? or or and return a boolean;
var a = 0, b = 3, с = a||b; alert(с); // 3
I.e
a ? a : b -> a||b
Recently rose similar
// PHP <= 5.2 $c=$a or $c=$b; // "||" не прокатит, для наглядности ($c = $a) or ($c = $b) // PHP 5.3+ $c = $a ?: $b;
||
" is not "logical or", but a function that returns the first argument if it is NOT null, NaN, undefined, 0
, otherwise, the second argument is timka_sSource: https://ru.stackoverflow.com/questions/69930/
All Articles