I want to wrap an existing function that takes unlimited number of arguments, e.g. this is the existing function:
function T()
{
$args = func_num_args();
// Do stuff with arguments.
}
I now want to wrap it, e.g.
/*
* This function shall also take unlimited arguments,
* and just pass them on to T().
*/
function myT()
{
// TODO: Take all arguments and pass them on to T().
$result = T();
// Do stuff with the result of T().
}
However, I cannot figure out how to pass the unlimited arguments on to T()
in myT()
.
use call_user_func_array()
(http://php.net/call_user_func_array)
$res = call_user_func_array("T", func_get_args());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With