Re: How can I use a function's default arguments but change one of the end ones in the list?
| From: | German Geek | Date: | Fri, 06 Feb 2009 01:10:19 +0000 |
| Subject: | Re: How can I use a function's default arguments but change one of the end ones in the list? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287783@lists.php.net to get a copy of this message | ||
I've thought about this problem before but couldn't think of a solution
either. How does func_get_args() solve this? You could make a wrapper
function without that.
How would u (php) know which parameter u mean in a particular case?
I think it would just be useful to have an IDE that can write out the
default parameters on a keyboard shortcut or mouse click and then u can
change them afterwards.
Cheers,
Tim
Tim-Hinnerk Heuer
http://www.ihostnz.com
On Fri, Feb 6, 2009 at 1:56 PM, Daniel Brown <danbrown@php.net> wrote:
> On Thu, Feb 5, 2009 at 18:50, Daevid Vincent <daevid@daevid.com> wrote:
> > Is there a way to use the default values of a function without
> > specifying every single one until the parameter you want to modify in
> > PHP5 ?
>
> Daevid,
>
> Check out func_get_args(): http://php.net/func_get_args
>
> Then you can rename your sql_query() function to real_sql_query()
> and create a new sql_query() as a wrapper function with
> func_get_args() in place of statically-defined variables.
>
> --
> </Daniel P. Brown>
> daniel.brown@parasane.net || danbrown@php.net
> http://www.parasane.net/ ||
> http://www.pilotpig.net/
> Unadvertised dedicated server deals, too low to print - email me to find
> out!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>