|
Posted by C. on 08/13/07 12:21
On 13 Aug, 01:42, rob <r...@rawb.net> wrote:
>
> For example, if I have the following array:
>
> $list = array('sky' => 'blue', 'grass' => 'green');
> $list = array_values($list);
>
> I'd like to pass the two values in $list to a function that has two
> arguments, i.e:
>
> function color($sky, $grass) { }
>
call_user_func('color', $list);
function color()
{
$params = func_get_args();
....
But it's much cleaner to do this:
color($list);
function color($list) // expect an array as input
{
....
Which eliminates the positional problems which are exacerbated by
variable argument parsing.
C.
Navigation:
[Reply to this message]
|