Signatur
is_subclass_of(mixed $object_or_class, string $class, bool $allow_string = true): bool
Beschreibung
Unterschied zu is_a(): nur true bei echter Vererbung, nicht bei Selbst.
Parameter
| Name | Typ | Default | Beschreibung |
|---|---|---|---|
| $object_or_class Pflicht | mixed | — | Objekt/Klasse. |
| $class Pflicht | string | — | Elternklasse. |
Rückgabewert
Typ
bool
Beispiele
Basis
<?php
is_subclass_of(RuntimeException::class, Exception::class); // true
is_subclass_of(Exception::class, Exception::class); // false