Start · Sprachen · PHP · Referenz · enum_exists

enum_exists

Funktion

Prüft, ob ein Enum definiert ist.

seit PHP 8.1.0 Kategorie: oop

Signatur

enum_exists(string $enum, bool $autoload = true): bool

Beschreibung

Wie class_exists(), aber spezifisch für Enums.

Parameter

Name Typ Default Beschreibung
$enum Pflicht string FQN.

Rückgabewert

Typ
bool

Beispiele

Basis

<?php

if (enum_exists(App\Status::class)) { /* ... */ }