Getting literal expression value with OR operators instead of true or false in PHP
You can use the Elvis operator for this purpose, e.g.
$test = 'a' ?: '' ?: 0;
var_dump($test);
> string(1) "a"
$test2 = 0 ?: 'b' ?: 'a';
var_dump($test2);
> string(1) "b"
There is also null coalescing operator (??) but it takes the second value only if the first is null, so e.g. 0 ?? 'a'
will take 0 because it's not null.