ReflectionFunctionAbstract::isClosure

(PHP 5 >= 5.3.0, PHP 7)

ReflectionFunctionAbstract::isClosureChecks if closure

Descrierea

public ReflectionFunctionAbstract::isClosure ( void ) : bool

Checks whether the reflected function is a Closure.

Parametri

Această funcție nu are parametri.

Valorile întoarse

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

Exemple

Example #1 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());
?>

Exemplul de mai sus va afișa:

bool(false)
bool(true)

A se vedea și