Re: [RFC] skipping optional parameters
| From: | Nikita Popov | Date: | Wed, 18 Apr 2012 00:08:01 +0000 |
| Subject: | Re: [RFC] skipping optional parameters | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60141@lists.php.net to get a copy of this message | ||
On Wed, Apr 18, 2012 at 2:03 AM, Etienne Kneuss <colder@php.net> wrote:
> Hi,
>
>
> On Wed, Apr 18, 2012 at 01:56, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>> Hi!
>>
>>> Since func_num_args() won't be able to be used to see if an argument is set, could
>>> a func_isset_arg() be added? So something like:
>>> if(func_num_args() > 2) $value = func_get_arg(2);
>>> would become:
>>> if(func_isset_arg(2)) $value = func_get_arg(2);
>>
>> I think it's easier to just do func_get_args() and check for isset there
>> :) You usually don't have too many args so getting all of them is not a
>> big problem.
>>
>
> +1
>
> BTW: the diffs show a lot of WS changes that you should probably fix.
On a side note, one can pass ?w=1 to the github diff, so it will show
up without WS changes:
https://github.com/smalyshev/php-src/commit/0f78493d3e96a627caa8258ee9e618301b6b3511?w=1
Makes is a bit easier to spot the relevant parts.
I'm also +1 on the proposal :)
Nikita