Signatur
property_exists(object|string $object_or_class, string $property): bool
Beschreibung
Anders als isset(): erkennt Properties auch mit null-Wert.
Parameter
| Name | Typ | Default | Beschreibung |
|---|---|---|---|
| $object_or_class Pflicht | object|string | — | Objekt/Klasse. |
| $property Pflicht | string | — | Property-Name. |
Rückgabewert
Typ
bool
Beispiele
Basis
<?php
if (property_exists($obj, 'email')) $mail = $obj->email;