I have an array of arguments that I want to pass to a function via call_user_func. The following code will currently give the error: Missing argument 2 for Closure. How can this be rewritten to work properly?
$args = array('foo', 'bar');
call_user_func(function($arg1, $arg2) {}, $args);
Try call_user_func_array() if you’re looking to pass an array of parameters.