note 8978 added to Function arguments
| From: | coop at better-mouse-trap dot com | Date: | Tue, 10 Oct 2000 00:59:37 +0000 |
| Subject: | note 8978 added to Function arguments | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6283@lists.php.net to get a copy of this message | ||
If you prefer to use named arguments to your functions (so you don't have to worry about the
order of variable argument lists), you can do so PERL style with anonymous arrays:
function foo($args)
{
print "named_arg1 : " . $args["named_arg1"] . "\n";
print "named_arg2 : " . $args["named_arg2"] . "\n";
}
foo(array("named_arg1" => "arg1_value", "named_arg2" =>
"arg2_value"));
====== will output: =======
named_arg1 : arg1_value
named_arg2 : arg2_value
http://www.php.net/manual/functions.arguments.php