3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test implements arrayaccess { public function offsetSet($offset, $value) { var_dump($offset); var_dump($value); } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) ? $this->container[$offset] : null; } } new test()[5] = 12345;
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
Parse error: syntax error, unexpected '[' in /in/C0kp6 on line 20
Process exited with code 255.

preferences:
175.04 ms | 1395 KiB | 61 Q