Based on the examples from this page, I have the working and non-working code samples below.
Working code using if statement:
if
if (!empty
If first variable($a) is null, then assign value of second variable($b) to first variable($a)
$a
null
$b
$a = 5; $b = 10; $a != ''?$a: $a = $b; echo $a;