Skip to content

Instantly share code, notes, and snippets.



Created Oct 27, 2015
What would you like to do?
PHP Curry
function curry(callable $function)
$args = array_slice(func_get_args(), 1);
return function() use ($function, $args) {
return call_user_func_array($function, array_merge($args, func_get_args()));

This comment has been minimized.

Copy link

@coderofsalvation coderofsalvation commented Jan 7, 2016

you might prefer passing closures over strings:


This comment has been minimized.

Copy link
Owner Author

@sebdesign sebdesign commented Jan 22, 2016

@coderofsalvation I'm not passing just strings. The callable hint accepts strings (function names), closures, anonymous functions, as well as array notation (['object/class', 'method']).

Closure ⊆ callable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment