-
-
Notifications
You must be signed in to change notification settings - Fork 20
Closed
Description
Why use call_user_func_array when it's slower than native function invoking, or even call_user_func?
$callable = fn() => null;
$args = [];
call_user_func_array($callable, $args); // slowest
call_user_func($callable, ...$args); // faster
$callable(...$args); // fastestI believe those are all equivalent options, across PHP versions 5, 7 and 8.
It has been optimized in the PHP core since the dark ages, but still the native call should be the fastest one.
Metadata
Metadata
Assignees
Labels
No labels