Is it possible to echo using ||
, so that it uses the first variable that evaluates to true?
for example,
$a = false;
$b = 'b';
echo $a || $b || 'neither'; // evaluates to 1 ?
Ternary operator
echo (($a) ? : $b) ? : 'neither';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With