(PHP 8 >= 8.2.0)
ReflectionFunction::isAnonymous — Checks if a function is anonymous
This function has no parameters.
Returns true
if the function is anonymous, otherwise false
.
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)