3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(E_ALL); $a = new ArrayObject(); $b = []; $a[null]['hurr'] = 'durr'; var_dump($a['epic_magic']); var_dump($b['epic_magic']); var_dump($c['epic_magic']); // Undefined var!! $d = []; var_dump($a['epic_magic']); // more magic! var_dump($d['epic_magic']); $e = 'srsly?'; var_dump($a['epic_magic']); // srsly.
Output for 5.4.8 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Notice: Undefined index: epic_magic in /in/JCIlt on line 8 NULL Notice: Undefined index: epic_magic in /in/JCIlt on line 9 NULL Notice: Undefined variable: c in /in/JCIlt on line 10 NULL Notice: Undefined index: epic_magic in /in/JCIlt on line 13 NULL Notice: Undefined index: epic_magic in /in/JCIlt on line 14 NULL Notice: Undefined index: epic_magic in /in/JCIlt on line 17 NULL
Output for 5.4.0 - 5.4.7
Warning: Illegal offset type in /in/JCIlt on line 6 Notice: Undefined index: epic_magic in /in/JCIlt on line 8 array(1) { ["hurr"]=> string(4) "durr" } Notice: Undefined index: epic_magic in /in/JCIlt on line 9 array(1) { ["hurr"]=> string(4) "durr" } Notice: Undefined variable: c in /in/JCIlt on line 10 Notice: Undefined index: epic_magic in /in/JCIlt on line 10 array(1) { ["hurr"]=> string(4) "durr" } Notice: Undefined index: epic_magic in /in/JCIlt on line 13 array(0) { } Notice: Undefined index: epic_magic in /in/JCIlt on line 14 array(0) { } Notice: Undefined index: epic_magic in /in/JCIlt on line 17 string(6) "srsly?"
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/JCIlt on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/JCIlt on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/JCIlt on line 4
Process exited with code 255.