I love doing this sort of thing in Perl: $foo = $bar || $baz
to assign $baz
to $foo
if $bar
is empty or undefined. You also have $foo ||= $bletch
which will only assign $bletch
to $foo
if $foo
is not defined or empty.
The ternary operator in this situation is tedious and tiresome. Surely there's a simple, elegant method available in PHP?
Or is the only answer a custom function that uses isset()?