Re: Supplying nothing at all for default parameters
| From: | Lukas Kahwe Smith | Date: | Fri, 09 Apr 2010 20:41:29 +0000 |
| Subject: | Re: Supplying nothing at all for default parameters | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-47848@lists.php.net to get a copy of this message | ||
On 06.04.2010, at 12:16, Richard Quadling wrote:
> Hello.
>
> A suggestion I would like to make is to allow for nothing to be
> supplied for defaulted parameters.
>
> I suppose the easiest way of describing this issue is with the
> following code ...
>
> <?php
> function foo($bar, $baz = 9, $buzz = 10) {
> return "$bar $baz $buzz";
> }
>
> // Whatever is supplied for $baz will be used for $baz.
> // User has to know the default value of $baz rather than just
> allowing the default value.
> echo foo(1, 9, 20);
>
> I don't know the stylics on using default parameters, but for the user
> to have to know the default value would sort of make the default
> redundant.
>
>
> // Passing nothing at all could be one option.
> echo foo(1, , 20);
i dont think is really a nice syntax to support. either we add named parameters are you just use the
current work around for the absence of named parameters (aka an array parameter and
array_merge/array_replace_recursive)
regards,
Lukas Kahwe Smith
mls@pooteeweet.org