How to suppress error if an argument is missing in a function call?

Valaccorb

New Member
I made a function like this (no need to write the whole function here) : \[code\]public function selectNode($from, $attributes = null, $childs = null)\[/code\]and, of course, if I call it this way :\[code\]$node->selectNode();\[/code\]The argument \[code\]$from\[/code\] isn't initialized and then you got a warning error.I know you can suppress the error doing \[code\]@$node->selectNode();\[/code\] or something like that thanks to \[code\]@\[/code\].But, I want to handle it myself. How can I do that if that's possible?The only way I found is to initialize it like this \[code\]public function selectNode($from = null, $attributes = null, $childs = null)\[/code\] but that doesn't make it clear ($from is not an option as the others).(And, of course, this function, here, is just an example. It could be extended to other functions)
 
Back
Top