1--TEST-- 2ZE2 ArrayAccess and ASSIGN_OP operators (+=) 3--FILE-- 4<?php 5 6class OverloadedArray implements ArrayAccess { 7 public $realArray; 8 9 function __construct() { 10 $this->realArray = array(1,2,3); 11 } 12 13 function offsetExists($index): bool { 14 return array_key_exists($this->realArray, $index); 15 } 16 17 function offsetGet($index): mixed { 18 return $this->realArray[$index]; 19 } 20 21 function offsetSet($index, $value): void { 22 $this->realArray[$index] = $value; 23 } 24 25 function offsetUnset($index): void { 26 unset($this->realArray[$index]); 27 } 28} 29 30$a = new OverloadedArray; 31$a[1] += 10; 32var_dump($a[1]); 33echo "---Done---\n"; 34?> 35--EXPECT-- 36int(12) 37---Done--- 38