3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = new StdClass; $foo->$bar = [ 'baz' => 'bang' ]; $bar = 'a'; echo $foo->$bar['baz'];
Output for 7.1.0 - 7.2.0
Notice: Undefined variable: bar in /in/Ta6BU on line 4 Notice: Undefined property: stdClass::$a in /in/Ta6BU on line 11
Output for 7.0.0 - 7.0.20
Notice: Undefined variable: bar in /in/Ta6BU on line 4 Fatal error: Uncaught Error: Cannot access empty property in /in/Ta6BU:4 Stack trace: #0 {main} thrown in /in/Ta6BU on line 4
Process exited with code 255.
Output for 5.4.10 - 5.6.28
Notice: Undefined variable: bar in /in/Ta6BU on line 4 Fatal error: Cannot access empty property in /in/Ta6BU on line 4
Process exited with code 255.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Ta6BU on line 4
Process exited with code 255.