php - How to suppress error if an argument is missing in a function call? -
i made function (no need write whole function here) :
public function selectnode($from, $attributes = null, $childs = null)
and, of course, if call way :
$node->selectnode();
the argument $from
isn't initialized , got warning error. know can suppress error doing @$node->selectnode();
or @
.
but, want handle myself. how can that if that's possible?
the way found initialize public function selectnode($from = null, $attributes = null, $childs = null)
doesn't make clear ($from not option others).
(and, of course, function, here, example. extended other functions)
you use try-catch block handling error yourself.
try { $node->selectnode(); } catch (exception $e){ echo $e; // whatever here error info $e, if leave parenthesis empty here nothing done , error message suppressed }
Comments
Post a Comment