Lars Schultz wrote: > As I am using it now: > function foo($x,$y,$options=array()){ > if ( !isset($options['opt1']) ) $options['opt1'] = 'foo'; > if ( !isset($options['opt2']) ) $options['opt2'] = 'bar'; > /* 1 */ > }
One little trick you can use to make things a bit more elegant right now: function foo($x, $y, $options=array()) { $options += array( 'opt1' => 'foo', 'opt2' => 'bar', ); ... } We're using this approach and since it's always right at the beginning of the function it also servers as sort of a documentation being a bit more concise, readable and less in danger of copy/paste errors than your version. Regards, - Chris -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php