note 34594 added to function.call-user-func-array
| From: | adamh at densi dot com | Date: | Thu, 31 Jul 2003 16:58:32 +0000 |
| Subject: | note 34594 added to function.call-user-func-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-53098@lists.php.net to get a copy of this message | ||
call_user_func_array() is nifty for calling PHP functions which use variable argument length. For
example:
$array = array(
array("foo", "bar"),
array("bat", "rat"),
);
$values = call_user_func_array("array_merge", $array);
var_dump($values);
/* output:
array(4) {
[0]=>
string(3) "foo"
[1]=>
string(3) "bar"
[2]=>
string(3) "bat"
[3]=>
string(3) "rat"
}
*/
The neat feature is that $array could have any number of arrays inside it.
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func-array.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34594
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34594&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34594&report=yes