call_user_func_array is very slow performance-wise, that's why in many cases you want to go with explicit method call. But, sometimes you want to pass arbitrary number of arguments passed as an array, e.g.
public function __call($name, $args) {
$nargs = sizeof($args);
if ($nargs == 0) {
$this->$name();
}
elseif ($nargs == 1) {
$this->$name($args[0]);
}
elseif ($nargs == 2) {
$this->$name($args[0], $args[1]);
}
#...
// you obviously can't go through $nargs = 0..10000000,
// so at some point as a last resort you use call_user_func_array
else {
call_user_func_array(array($this,$name), $args);
}
}
I'd go with checking $nargs up to 5 (it's usually unlikely that a function in PHP accepts more than 5 arguments, so in most cases we will call a method directly without using call_user_func_array which is good for performance)
The result of $class->method($arg) is the same as call_user_func_array(array($class,'method'), array($arg)), but the first one is faster.