$p->myarray['title'] = "Hello";
This does not invoke the __set magic method; you definitely do not set the property, you change part of it. In this case, PHP will call the __get method to retrieve the array stored in the $p->myarray , if such a magic method exists. Please note that to change the return value to any effect on the property, you need to return by the link:
function &__get($mbr_name) { return $this->$mbr_name; }
source share