I love doing this sort of thing in Perl: $foo = $bar || $baz to assign $baz to $foo if $bar is empty or undefined. You al
$foo = $bar || $baz
$baz
$foo
$bar
In PHP 7 we finally have a way to do this elegantly. It is called the Null coalescing operator. You can use it like this:
$name = $_GET['name'] ?? 'john doe';
This is equivalent to
$name = isset($_GET['name']) ? $_GET['name']:'john doe';