3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test implements ArrayAccess { public function __get($k) { return 1; } public function __set($k, $v) { echo "__set($v)\n"; } public function offsetGet($k) { return 1; } public function offsetSet($k, $v) { echo "offsetSet($v)\n"; } public function offsetExists($k) {} public function offsetUnset($k) {} } $t = new Test; echo "Property:\n"; $t->x++; echo "Offset:\n"; $t[0]++;
based on 1ZZsT
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.26, 7.4.0 - 7.4.14, 8.0.0
Property: __set(2) Offset: Notice: Indirect modification of overloaded element of Test has no effect in /in/EFpo1 on line 25