3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Test { function __toString() { return 'Test'; } } $a = array(); $b = new Test(); var_dump($a[$b]);
Output for 5.2.3 - 5.6.28, 7.0.0 - 7.1.0
Warning: Illegal offset type in /in/hlUno on line 12 NULL
Output for hhvm-3.12.0
Warning: Invalid operand type was used: Invalid type used as key in /in/hlUno on line -1 Notice: Undefined index: Test in /in/hlUno on line -1 NULL
Output for hhvm-3.10.0
Warning: Invalid operand type was used: Invalid type used as key in /in/hlUno on line 12 Notice: Undefined index: Test in /in/hlUno on line 12 NULL
Output for 4.3.0 - 5.2.2
<br /> <b>Warning</b>: Illegal offset type in <b>/in/hlUno</b> on line <b>12</b><br /> NULL