ReflectionProperty::isInitialized

(PHP 7 >= 7.4.0, PHP 8)

ReflectionProperty::isInitializedChecks whether a property is initialized

Beschreibung

public ReflectionProperty::isInitialized(?object $object = null): bool

Checks whether a property is initialized.

Parameter-Liste

object

If the property is non-static an object must be provided to fetch the property from.

Rückgabewerte

Returns false for typed properties prior to initialization, and for properties that have been explicitly unset(). For all other properties true will be returned.

Fehler/Exceptions

Throws a ReflectionException if the property is inaccessible. You can make a protected or private property accessible using ReflectionProperty::setAccessible().

Changelog

Version Beschreibung
8.0.0 object is nullable now.

Beispiele

Beispiel #1 ReflectionProperty::isInitialized() example

<?php
class User
{
    public 
string $name;
}

$rp = new ReflectionProperty('User''name');
$user = new User;
var_dump($rp->isInitialized($user));
$user->name 'Nikita';
var_dump($rp->isInitialized($user));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(false)
bool(true)

Siehe auch

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

Was genau bedeutet "Vibe Coding"? Ein tiefgehender Blick für Entwickler

In der Welt der Softwareentwicklung gibt es unzählige Wege, wie man an ein Projekt herangeht. Manche schwören auf strikte Planung, andere auf bewährte Algorithmen und wieder andere lassen sich von etwas ganz anderem leiten: ihrem Gefühl. ...

admin

Autor : admin
Kategorie: Software & Web-Development

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

SEO-URLs und MySQL

Scary Teacher 3D (https://scaryteacher-3d.io/) stealth gameplay strategies often focus on understanding Miss T's movement patterns before attempti ...

Geschrieben von sftad am 30.05.2026 05:33:22
Forum: SQL / Datenbanken
U4GM FH6: Where the Montero Evolution Is

If you're hunting the 1997 Mitsubishi Montero Evolution, don't start by combing every dirt lane in Japan and hoping for the best. FH6 locks this B ...

Geschrieben von Blustery am 30.05.2026 04:01:24
Forum: Off-Topic Diskussionen
U4GM POE 2: What Makes Arbiter of Ash a Bad Farm

Some bosses in Path of Exile 2 beat you because you misread a slam or built too greedily. Arbiter of Ash feels different. After a few runs, the fi ...

Geschrieben von Blustery am 30.05.2026 03:59:37
Forum: PHP Developer Forum
U4GM Diablo 4: Why Pounds of Flesh Are Worth Farming

Getting Pounds of Flesh isn't something you'll do by accident while levelling a fresh character. It's an endgame material, and it starts to matter ...

Geschrieben von Blustery am 30.05.2026 03:58:15
Forum: Bücher-Forum