Passing multiple parameters to a method in PHP

anonymousx

New Member
I'm working on a simple class right now to get my head around OOP and I need some help with a function. The function receives various parameters, some of are optional: \[code\]public function Test($req, $alsoreq, $notreq = null, $notreq2 = null, $notreq3 = null){ ...}\[/code\]How do I call the function, passing the two first parameters and the last one? For example:\[code\]Test('req', 'alsoreq', 'notreq3'); \[/code\]Ignoring the \[code\]notreq2\[/code\] and \[code\]notreq\[/code\]? I tried \[code\]Test('req', 'alsoreq', '', '', 'notreq3');\[/code\]but this seems ugly and hackish.
 
Back
Top