Problem with optional arguments in PHP

bughot

New Member
I have a function which takes four optional arguments:\[code\]public function doSomething($x = null, $y = null, $a = null, $b = null) { }\[/code\]However when I try to call this function and specify only $y for instance:\[code\]$object->doSomething($y=3)\[/code\]It seems to ignore that I am setting $y as 3, and instead sets $x to be 3. Is there any reason why this might happen with PHP? I never used to have this issue before...Thanks,Dan
 
Back
Top