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 wa
sleep
wa
function alias($function) { return function (/* *args */) use ($function){ return call_user_func_array( $function, func_get_args() ); }; } $uppercase = alias('strtoupper'); $wait = alias('sleep'); echo $uppercase('hello!'); // -> 'HELLO!' $wait(1); // -> …