I'm just wondering if there is a quick way to echo undefined variables without getting a warning? (I can change error reporting level but I don't want to.) The smallest I have so far is:
isset($variable)?$variable:''
I dislike this for a few reasons:
$variable
is repeated$arrayvar['parameter']
you could use the ifsetor() example taken from here:
function ifsetor(&$variable, $default = null) {
if (isset($variable)) {
$tmp = $variable;
} else {
$tmp = $default;
}
return $tmp;
}
for example:
echo ifsetor($variable);
echo ifsetor($variable, 'default');
This does not generate a notice because the variable is passed by reference.