3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo {} $arr = []; $f = new Foo; $arr[$f] = 1; var_dump($arr);
based on ekUGJ
Output for 5.4.0 - 5.4.16, 5.4.18 - 5.4.45, 5.5.1 - 5.6.26, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
Warning: Illegal offset type in /in/KLh6q on line 7 array(0) { }
Output for 5.4.17, 5.5.0

Process exited with code 137.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/KLh6q 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/KLh6q on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/KLh6q on line 4
Process exited with code 255.