Signatur
is_a(mixed $object_or_class, string $class, bool $allow_string = false): bool
Beschreibung
Für Strings mit $allow_string = true. Praktisch, wenn man nur den Klassennamen als String hat.
Parameter
| Name | Typ | Default | Beschreibung |
|---|---|---|---|
| $object_or_class Pflicht | mixed | — | Objekt/Klasse. |
| $class Pflicht | string | — | Zu prüfende Klasse. |
| $allow_string | bool | false | Strings erlauben. |
Rückgabewert
Typ
bool
Beispiele
Basis
<?php
is_a($obj, \Exception::class); // wie $obj instanceof \Exception