<?php
function isset_n_empty($var) {
if (isset($var) && !empty($var)){
return true;
}
return false;
}
echo isset_n_empty($x ?? null);
?>
my function is supposed to do the simple if (isset() && !empty())
logic and i used $x ?? null
because if it is not used it would give me this error for undefined variables as the example
E_NOTICE : type 8 -- Undefined variable: x -- at line z
is it redundant or well-optimized?