Can the || operator be used to select between values of non-boolean types in PHP?

echo, php, syntax

Solution

Ternary operator

echo (($a) ? : $b) ? : 'neither';

Problem

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 ? ```

Original source