PHP 7.2.25 Released

ReflectionClass::getProperty

(PHP 5, PHP 7)

ReflectionClass::getPropertyBir özellik döndürür

Açıklama

public ReflectionClass::getProperty ( string $isim ) : ReflectionProperty

Bir özellik döndürür.

Uyarı

Bu işlev hala belgelendirilmemiştir; sadece değiştirge listesi mevcuttur.

Değiştirgeler

isim

Özelliğin ismi.

Dönen Değerler

Bir ReflectionProperty nesnesi.

Ayrıca Bakınız

add a note add a note

User Contributed Notes 2 notes

up
26
eric at naeseth dot com
8 years ago
If the class doesn't have a property with the given name, a ReflectionException will be raised.
up
7
dohpaz42
4 years ago
Accessing private properties is possible, but care must be taken if that private property was defined lower into the inheritance chain. For example, if class A extends class B, and class B defines a private property called 'foo', getProperty will throw a ReflectionException.

Instead, you can loop over getParentClass until it returns false to look for the private property, at which point you can access and/or modify its value as needed.
To Top