也许更清楚:
//PHP will try to interpret this:
$object->foo['bar'] = 42
//The PHP interpreter will try to evaluate first
$object->foo
//To do this, it will call
$object->__get('foo')
// and not __get("foo['bar']"). __get() has no idea about ['bar']
//If we have get defined as &__get(), this will return $_data['foo'] element
//by reference.
//This array element has some value, like a string:
$_data['foo'] = 'value';
//Then, after __get returns, the PHP interpreter will add ['bar'] to that
//reference.
$_data['foo']['bar']
//Array element $_data['foo'] becomes an array with one key, 'bar'.
$_data['foo'] = array('bar' => null)
//That key will be assigned the value 42
$_data['foo']['bar'] = 42
//42 will be stored in $_data array because __get() returned a reference in that
//array. If __get() would return the array element by value, PHP would have to
//create a temporary variable for that element (like $tmp). Then we would make
//that variable an array with $tmp['bar'] and assign 42 to that key. As soon
//as php would continue to the next line of code, that $tmp variable would
//not be used any more and it will be garbage collected.