PHP 8.5.0 Alpha 4 available for testing

Voting

: min(one, five)?
(Example: nine)

The Note You're Voting On

dohpaz42
10 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.

<< Back to user notes page

To Top