I'd like to pass variable function arguments to one function, foo, and then have foo pass the variable function arguments on to another function, bar.
At the same time, the initial caller should also be able to call bar directly with variable function arguments.
How can I do this, since $args is converted to an array when it reaches foo and thus can't be passed on as variable function arguments?
function bar($prefix, ...$args) {
foreach($args as $arg)
echo "bar: $prefix: $arg\n";
}
function foo($prefix, ...$args) {
echo "Just passing through...\n";
foreach($args as $arg)
echo "foo: $prefix: $arg\n";
bar($prefix, $args); // wrong, since $args is now an array
}
foo("Idefix", "FOO", "BAR");
bar("Obelix", "ABC", "DEF");