call_user_func_array - Function

call_user_func_array - Function

Name:
———
call_user_func_array — Alternate method for calling functions.

Synopsis:
————-
mixed call_user_func_array(function_name[, argument_array]);
string function_name: Function to be called
array argument_array (optional): Array of arguments to be passed to function_name

Returns:
————
Return value of function_name; if function_name is not a valid function name, the function generates a warning and no value is returned.

Description:
—————-
call_user_func_array() is primarily useful as a way to dynamically call functions and methods at runtime without having to use eval() . call_user_func_array() passes the elements in argument_array to function_name as an argument list. This makes it easy to pass an unknown number of arguments to a function.

Example:
————-

Normally, functions are called with the following syntax:

function1 (’arg1′, ‘arg2′, …);

Calling the same function using call_user_func_array() would look like this:

call_user_func_array (’function1′, array (’arg1 ‘, ‘arg2′, …));

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.