Hi,

This is interesting and it appears the following change makes the snippet work as expected:

    public function &__get($name);


On 3/17/10 3:55 PM, mathieu.suen wrote:
Hi,


I came across a strange behavior when using the magic method __get and
some instance variable that should be an array.
Consider the following example:


class A
{

public function __get($name)
{
$this->$name = array();
return $this->$name;
}

public function test()
{
$this->_zork['bar'] = 67;
}
}

$a = new A;
$a->test();

var_dump($a);


So could someone explain me what is the semantic of the above statements?

Thanks


-- Mathieu Suen




--
Ionut G. Stan
I'm under construction  |  http://blog.igstan.ro/

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to