3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $obj1 = new StdClass(); $obj1->name = ‘Kathy’; $obj2 = new StdClass(); $obj2->name = ‘Cal’; $returnValue = [$obj1, $obj2][0]->name;
Output for 7.2.0
Warning: Use of undefined constant ‘Kathy’ - assumed '‘Kathy’' (this will throw an Error in a future version of PHP) in /in/KA0Jf on line 4 Warning: Use of undefined constant ‘Cal’ - assumed '‘Cal’' (this will throw an Error in a future version of PHP) in /in/KA0Jf on line 8
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant ‘Kathy’ - assumed '‘Kathy’' in /in/KA0Jf on line 4 Notice: Use of undefined constant ‘Cal’ - assumed '‘Cal’' in /in/KA0Jf on line 8
Output for 5.5.24 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/KA0Jf on line 10
Process exited with code 255.
Output for 5.3.20 - 5.4.45
Parse error: syntax error, unexpected '[' in /in/KA0Jf on line 10
Process exited with code 255.