在PHP中将数组作为参数传递非用户函数

I have the following code:

$bin = "\x04\x00\xa0\x00\x04\x00\xa0\x00";
$unpack_data = unpack("C*", $bin);
$arr = array($unpack_data[1], $unpack_data[2], $unpack_data[3]);

How can I pass an array $arr to a pack() function? The only thing that I can make:

$res = pack("C*", $unpack_data[1], $unpack_data[2], $unpack_data[3]);

but the length and content of the array are getting in the course of the program.

Like this:

call_user_func_array('pack', array_merge(['C*'], $unpack_data))
$res = pack('C*',$arr)

//hope this might help you

New php 5.6 syntax allow this

pack('C*', ...$unpack_data);