(PHP 8 >= 8.2.0)
ReflectionFunction::isAnonymous — Checks if a function is anonymous
This function has no parameters.
Example #1 ReflectionFunction::isAnonymous() example
<?php
$rf = new ReflectionFunction(function() {});
var_dump($rf->isAnonymous());
$rf = new ReflectionFunction('strlen');
var_dump($rf->isAnonymous());
?> The above example will output:
bool(true) bool(false)
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/reflectionfunction.isanonymous.php