Created
June 24, 2014 22:20
-
-
Save webbower/4ab5ce3f3eca80e9e398 to your computer and use it in GitHub Desktop.
Functional utility function to wrap a declared function in a passable variable for chaining (PHP 5.4+ version)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function lambdafy(callable $funcname) { | |
return function() use ($funcname) { | |
return call_user_func_array($funcname, func_get_args()); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment