3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $container = new \ArrayObject; $save = new \ArrayObject; for ($i = 0; $i < 10; $i++) { $object = new \stdClass; $container[$i] = $object; $save[$i] = $object; $container->offsetUnset($i); } var_dump($container); var_dump($save);
based on ZVROQ
Output for 5.3.0 - 7.2.0
object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(0) { } } object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(10) { [0]=> object(stdClass)#3 (0) { } [1]=> object(stdClass)#4 (0) { } [2]=> object(stdClass)#5 (0) { } [3]=> object(stdClass)#6 (0) { } [4]=> object(stdClass)#7 (0) { } [5]=> object(stdClass)#8 (0) { } [6]=> object(stdClass)#9 (0) { } [7]=> object(stdClass)#10 (0) { } [8]=> object(stdClass)#11 (0) { } [9]=> object(stdClass)#12 (0) { } } }
Output for 5.0.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 7 object(ArrayObject)#1 (0) { } object(ArrayObject)#2 (10) { [0]=> object(stdClass)#3 (0) { } [1]=> object(stdClass)#4 (0) { } [2]=> object(stdClass)#5 (0) { } [3]=> object(stdClass)#6 (0) { } [4]=> object(stdClass)#7 (0) { } [5]=> object(stdClass)#8 (0) { } [6]=> object(stdClass)#9 (0) { } [7]=> object(stdClass)#10 (0) { } [8]=> object(stdClass)#11 (0) { } [9]=> object(stdClass)#12 (0) { } }
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 7 Fatal error: Cannot instantiate non-existent class: arrayobject in /in/OHdlj on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/OHdlj on line 7 Fatal error: Cannot instantiate non-existent class: arrayobject in /in/OHdlj on line 3