Re: Re: Named Parameters
| From: | Stanislav Malyshev | Date: | Mon, 12 Apr 2010 23:10:42 +0000 |
| Subject: | Re: Re: Named Parameters | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47896@lists.php.net to get a copy of this message | ||
Hi!
Proposed new syntax of this case: function foo($x,$y){ $options = func_get_args(); if ( !isset($options['opt1']) ) $options['opt1'] = 'foo'; if ( !isset($options['opt2']) ) $options['opt2'] = 'bar'; /* 1 */ }I think the idea is to do: function foo($x,$y, $opt1 = 'foo', $opt2 = 'bar'){ } foo(1,2); foo(1,2,'opt1'=>'no-foo'); -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com