How to access properties in ArrayAccess like Phalcon?

Take a look at

It seems that Phalcon can do $config->app->controllersDir
And, I see that the config object implements ArrayAccess
How to do that ? I think the only possible way is $config[‘app’][‘controllersDir’], but Phalcon can do it.
I think that it may have __get() methods, but looking at the source code, it doesn’t.

ArrayAccess only ensures that you can call something as $obj['key']. where that value is stored is an implementation detail.

if you look at your URL (end of the text) there is a config object dump. from that you can conclude that $config->app is an actual object property.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.