Andrew McCombe


Full Stack Web Developer

Do PHP objects use getters and setters internally?

I just came across something that made me wonder wether a PHP object uses the magic __get() and __set() methods inside the object itself.  I wrote the following code to test: < ?php class Test { public function __construct() { $this->name = ‘Andrew’; } public function __get($name) { echo ‘__get: ‘ . $name . “\n”; […]