Re: How can I use a function's default arguments but change one of the end ones in the list?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



""Boyd, Todd M."" <tmboyd1@xxxxxxxx> wrote in message 
news:33BDE0B2C17EEF46ACBE00537CF2A19003D075E5@xxxxxxxxxxxxxxxxxxxxxxx
> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@xxxxxxxxxx]
> Sent: Friday, February 06, 2009 2:26 PM
> To: php-general@xxxxxxxxxxxxx
> Subject: Re:  How can I use a function's default arguments but
> change one of the end ones in the list?
>
> On Fri, 2009-02-06 at 14:10 +1300, German Geek wrote:
>
> > I've thought about this problem before but couldn't think of a
> > solution either.
>
>
> Well, I guess I *did* think of a solution, it just happens that PHP
> doesn't do "the logical thing"(tm)
>
> ;-)
>
> I would hope the PHP developers would implement this idea for a future
> version. The concept is simple, just specify which parameters in the
> function call you want to change and leave the others as their
default.
>
> I've added it here: http://bugs.php.net/bug.php?id=47331 with comments
> about similar/related bugs.
>
> Feel free to vote on this. I think it's a necessary addition to the
> language and often a source of frustration for me in large projects
> especially where functions get older and older and more parameters are
> needed to maintain backwards compatibility yet get new functionality
> too.

Just tell 'em that .NET already has it; that'll light a fire under them!
:D
C# can do function calls like:

FunctionName(VariableName:=Value);

I wholeheartedly prefer PHP to .NET for most things... but you've got to
admit--that's a pretty slick feature. Me likey.


// Todd

I don't remember what it was I was using, but I remember a lang that allowed 
func(,,,,,,,change,,,change) where all the empty comas just went to default. 
*shrug* 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux