Skip to content
Advertisement

Can I get the value of a private property with Reflection?

It doesn’t seem to work:

JavaScript

It gets into the IF loop, and then throws an error:

Property privateProperty does not exist

😐

$ref = new ReflectionProperty($obj, 'privateProperty') doesn’t work either…

The documentation page lists a few constants, including IS_PRIVATE. How can I ever use that if I can’t access a private property lol?

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement