Reputation: 5736
Is it possible to use PHP magic methods (specifically __get()) outside a defined class?
I'm wanting to use it in a configuration file for quick loading. The configuration file has a single array, $config, with many keys. Therefore, I'd like to override __get() to return the key in the array.
Upvotes: 1
Views: 227
Reputation: 51678
No, but you could write an object that reads the config file, and provides the __get method.
Upvotes: 1