|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-12-10 11:12 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 08:00:02 2025 UTC |
Description: ------------ When calling a defined function like this: call_user_func_array ('myfunc', $myarray); The $myarray array only contains the first value, but not the whole array. For instance: function myfunc ($myarray) { if (is_array($myarray)) print("It's an array"); else print ("It's not an array"); } call_user_func_array ('myfunc', array ("first", "second", "third")); Then you would receive the message "It's not an array". If you print_r the array, then you would only get "first". Then, if you change the call to this: call_user_func_array ('myfunc', array (array ("first", "second", "third"))); It works as expected. So, the documentation available at http://es.php.net/manual/en/function.call-user-func-array.php seems to be wrong. Thanks for your time. Hope this helps. Reproduce code: --------------- function myfunc ($myarray) { if (is_array($myarray)) print("It's an array"); else print ("It's not an array"); } call_user_func_array ('myfunc', array ("first", "second", "third")); Expected result: ---------------- It's an array Actual result: -------------- It's not an array