Is it possible to alias a function with a different name in PHP? Suppose we have a function with the name sleep
. Is there a way to make an alias called wait
?
By now I'm doing like this:
function wait( $seconds ) {
sleep($seconds);
}
yup, function wait ($seconds) { sleep($seconds); }
is the way to go. But if you are worried about having to change wait() should you change the number of parameters for sleep() then you might want to do the following instead:
function wait() {
return call_user_func_array("sleep", func_get_args());
}