ReflectionClass::isAnonymous

(PHP 7, PHP 8)

ReflectionClass::isAnonymousChecks if class is anonymous

Beschreibung

public ReflectionClass::isAnonymous(): bool

Checks if a class is an anonymous class.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

Beispiel #1 ReflectionClass::isAnonymous() example

<?php
class TestClass {}
$anonClass = new class {};

$normalClass = new ReflectionClass('TestClass');
$anonClass = new ReflectionClass($anonClass);

var_dump($normalClass->isAnonymous());
var_dump($anonClass->isAnonymous());

?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(false)
bool(true)

Siehe auch

add a note add a note

User Contributed Notes

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