PHP 8.6.0 Beta 1 is available for testing

ReflectionFunctionAbstract::isClosure

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

ReflectionFunctionAbstract::isClosureVerifica si es una función anónima

Descripción

public function ReflectionFunctionAbstract::isClosure(): bool

Verifica si la función reflejada es una Closure .

Parámetros

Esta función no contiene ningún parámetro.

Valores devueltos

Retorna true si la función es una Closure , de lo contrario false

Ejemplos

Ejemplo #1 Ejemplo de ReflectionFunctionAbstract::isClosure()

<?php
// No es una función anónima
$function1 = 'str_replace';
$reflection1 = new ReflectionFunction($function1);
var_dump($reflection1->isClosure());
// Función anónima
$function2 = function () {};
$reflection2 = new ReflectionFunction($function2);
var_dump($reflection2->isClosure());
?>

El ejemplo anterior mostrará:

bool(false)
bool(true)

Véase también

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug
+add a note

User Contributed Notes

There are no user contributed notes for this page.

AltStyle によって変換されたページ (->オリジナル) /