Checks if a function is anonymous

- « ReflectionFunction::invokeArgs

- ReflectionFunction::isDisabled »

- PHP Manual
- ReflectionFunction
- Checks if a function is anonymous

# ReflectionFunction::isAnonymous

(PHP 8 >= 8.2.0)

ReflectionFunction::isAnonymous — Checks if a function is anonymous

### Description

public ReflectionFunction::isAnonymous(): bool

Checks if a function is anonymous.

### Parameters

This function has no parameters.

### Return Values

Returns `true` if the function is anonymous, otherwise `false`.

### Examples

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)

### See Also

- Anonymous functions