1--TEST-- 2Using indirect append on ArrayAccess object 3--FILE-- 4<?php 5 6class AA implements ArrayAccess { 7 private $data = []; 8 public function &offsetGet($name) { 9 if (null === $name) { 10 return $this->data[]; 11 } else { 12 return $this->data[$name]; 13 } 14 } 15 public function offsetSet($name, $value) { 16 $this->data[$name] = $value; 17 } 18 public function offsetUnset($name) {} 19 public function offsetExists($name) {} 20} 21 22$aa = new AA; 23$aa[3] = 1; 24$aa[][][0] = 2; 25var_dump($aa); 26 27?> 28--EXPECT-- 29object(AA)#1 (1) { 30 ["data":"AA":private]=> 31 array(2) { 32 [3]=> 33 int(1) 34 [4]=> 35 array(1) { 36 [0]=> 37 array(1) { 38 [0]=> 39 int(2) 40 } 41 } 42 } 43} 44