In Python one can do:
foo = {} assert foo.get(\'bar\', \'baz\') == \'baz\'
In PHP one can go for a trinary operator as in:<
PHP 5.3 has a shortcut version of the ternary operator:
$x = $foo ?: 'defaultvaluehere';
which is basically
if (isset($foo)) { $x = $foo; else { $x = 'defaultvaluehere'; }
Otherwise, no, there's no shorter method.