3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class X implements ArrayAccess { function offsetGet($n) { var_dump(0,$n); return "42";} function offsetSet($x, $z) { var_dump($x, $z); } function offsetExists($n) {} function offsetUnset($n) {} } $x = new X(); $x[23]++;
based on hbHRT
Output for 5.2.1 - 7.1.0
int(0) int(23) Notice: Indirect modification of overloaded element of X has no effect in /in/RcluA on line 10
Output for 5.0.0 - 5.2.0
int(0) int(23) Fatal error: Objects used as arrays in post/pre increment/decrement must return values by reference in /in/RcluA on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/RcluA on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting '{' in /in/RcluA on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'{'' in /in/RcluA on line 2
Process exited with code 255.