Date: 09/25/01
- Next message: jimw <email protected>: "[PHP-DEV] Re: 403 on www.php.net (fwd)"
- Previous message: jah <email protected>: "[PHP-DEV] Bug #7888 Updated: decrement syntax should be -- instead of -"
- In reply to: Hartmut Holzgraefe: "Re: [PHP-DEV] Feature?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Hartmut Holzgraefe <hartmut <email protected>>]
> Andy wrote:
>
> >In the case when I've few parameters I've to remember their order, so why not
> >$bar=foo('par2'=>10);
> >I want to pass value to only one or more but not to all params.
> >Also this will make the code clearer I think.
> >
> you can use arrays to mimic this behavior
>
> function foo($bar) {
> ...
> if(isset($bar['par2'])) ....
> ...
> }
>
> foo(array('par2'=>10));
Or even less:
function foo($bar) {
extract($bar);
...
if (isset($par2)) ....
...
}
It needs a defaulting mechanism though.
- Stig
-- Stig Sæther Bakken <ssb <email protected>> Fast Search & Transfer ASA, Trondheim, Norway-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: jimw <email protected>: "[PHP-DEV] Re: 403 on www.php.net (fwd)"
- Previous message: jah <email protected>: "[PHP-DEV] Bug #7888 Updated: decrement syntax should be -- instead of -"
- In reply to: Hartmut Holzgraefe: "Re: [PHP-DEV] Feature?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

