Dutch PHP Conference 2025 - Call For Papers

ReflectionFunctionAbstract::isClosure

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

ReflectionFunctionAbstract::isClosureChecks if closure

Опис

public ReflectionFunctionAbstract::isClosure(): bool

Checks whether the reflected function is a Closure.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Returns true if the function is a Closure, otherwise false.

Приклади

Приклад #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());
?>

Поданий вище приклад виведе:

bool(false)
bool(true)

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top