note 30618 modified in function.func-get-args by danbrown
| From: | danbrown@php.net | Date: | Sat, 19 Jul 2008 21:48:04 +0000 |
| Subject: | note 30618 modified in function.func-get-args by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141767@lists.php.net to get a copy of this message | ||
You can also fake named arguments using eval:
<?php
function test()
{ foreach (func_get_args() as $k=>$arg) eval ("\$$arg;");
echo "$a plus $b gives ".($a+$b);
}
test("a=3","b=4");
?>
--was--
You can also fake named arguments using eval:
function test()
{ foreach (func_get_args() as $k=>$arg) eval ("\$$arg;");
echo "$a plus $b gives ".($a+$b);
}
test("a=3","b=4");
http://php.net/manual/en/function.func-get-args.php