When you are on PHP 5.6, you should use the decompress argument , as it is about 4-5 times faster than using call_user_func_array
pack('C*', ...$array);
And when you are on PHP 5.5 or lower, you should use ReflectionFunction , which seems to be a little faster than call_user_func_array :
$packFunction = new ReflectionFunction('pack'); $packFunction->invokeArgs(array_merge(array('C*'), $array));
source share