Re: [RFC] Named parameters

From: Date: Sat, 07 Sep 2013 18:05:52 +0000
Subject: Re: [RFC] Named parameters
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Sat, Sep 7, 2013 at 6:55 PM, Matthew Leverton <[email protected]> wrote:
>
> The OCD in me shudders to think about now having to parse through
> people's code like:
>
> substr('length' => 1, 'string' => 'Hello World');
>

Hi, Matthew

Wouldn't this just fail, because one required parameter is omitted?

You can just leave out parameters, that have a default-value.
Otherwise it's treated like calling:

substr('Hello World');
// Warning: substr() expects at least 2 parameters, 1 given in php
shell code on line 1

I would return the same, even so the parameter-count is 2, but the 2nd
parameter is missing, but required.

Bye
Simon


Thread (46 messages)

« previous php.internals (#68954) next »