php is_function() to determine if a variable is a function
Use is_callable
to determine whether a given variable is a function. For example:
$func = function()
{
echo 'asdf';
};
if( is_callable( $func ) )
{
// Will be true.
}
You can use function_exists
to check there is a function with the given name. And to combine that with anonymous functions, try this:
function is_function($f) {
return (is_string($f) && function_exists($f)) || (is_object($f) && ($f instanceof Closure));
}