- error_reporting: documentation ( source)
<?php
error_reporting(E_ALL);
class RefArray implements ArrayAccess {
public $array;
public function &offsetGet($key) { return $this->array[$key]; }
public function offsetSet($key, $value) { $this->array[$key] = $value; }
public function offsetExists($key) { return isset($this->array[$key]); }
public function offsetUnset($key) { unset($this->array[$key]); }
}
$arr = new RefArray;
$arr[0] = 'abc';
$arr[1] =& $arr[0];