Skip to content

Instantly share code, notes, and snippets.

@rodnaph
Last active December 15, 2015 02:39
Show Gist options
  • Save rodnaph/5188923 to your computer and use it in GitHub Desktop.
Save rodnaph/5188923 to your computer and use it in GitHub Desktop.
Get reference to any PHP function
<?php
function f($name)
{
return function() use ($name) {
return call_user_func_array($name, func_get_args());
};
}
@rodnaph
Copy link
Author

rodnaph commented Mar 18, 2013

WICKED INIT! And should work for method refs too like...

<?php

$foo = f(array($object, 'method'));

@bendavies
Copy link

SO READABLE

@bendavies
Copy link

WINK

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