I've got an array like this
array('item1', 'item2', 'item3');
Does anybody know how I would pass each item into a function seperately?
EG:
hello_world('item1', 'item2', 'item3');
I've got an array like this
array('item1', 'item2', 'item3');
Does anybody know how I would pass each item into a function seperately?
EG:
hello_world('item1', 'item2', 'item3');
hello_world($array[0], $array[1], $array[2])
or
call_user_func_array('hello_world', $array)
$array[0] ... etc wouldn't help here as it needs to be dynamic. I'm passing items from the URL into the function so with /MyAction/hello/world and MyAction($item1, $item2): $item1 would be hello and $item2 would be worldhttp://www.php.net/manual/en/function.call-user-func-array.php
call_user_func_array('func',$myArgs);
array_map help here?