Named parameters are great for a long list of options in a PHP user defined function or class. But what about nested options?
Eg:
function foobar($foo,$bar,$options=array()) {
$default_options = array('option1'=>'','option2'=>'hello','option3'=>array('option1'=>true,'option2'=>''));
$options = array_merge($default_options,(array)$options);
}
So option 3 is another array with suboptions. Would we need to put them in a for loop to merge the suboptions too? What would you guys do in this case?
EDIT:
This is the function call:
foobar('foo','bar',array('option1'=>'foo','option3'=>array('option1'=>false)));
Ending structure for $options:
array(
'option1'=>'foo',
'option2'=>'hello',
'option3'=>array(
'option1'=>false,
'option2'=>''
);