ReflectionFunctionAbstract::isClosure

(PHP 5 >= 5.3.0, PHP 7)
Checks if closure
public bool ReflectionFunctionAbstract::isClosure ( void )

Checks whether the reflected function is a Closure.

Returns:

Returns TRUE if the function is a Closure, otherwise FALSE.

Examples:
ReflectionFunctionAbstract::isClosure() example
<?php
// Non-closure
$function1 = 'str_replace';
$reflection1 = new ReflectionFunction($function1);
var_dump($reflection1->isClosure());

// Closure
$function2 = function () {};
$reflection2 = new ReflectionFunction($function2);
var_dump($reflection2->isClosure());
?>

The above example will output:

bool(false)
bool(true)
See also:

ReflectionFunctionAbstract::isGenerator() -

doc_php
2016-02-24 16:13:37
Comments
Leave a Comment

Please login to continue.