3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = new StdClass; $bar = 'a'; $foo->$bar = [ 'baz' => 'bang' ]; echo $foo->$bar['baz'];
based on Ta6BU
Output for 7.0.0 - 7.2.0
bang
Output for 5.4.10 - 5.6.28
Warning: Illegal string offset 'baz' in /in/0QneW on line 12 Notice: Array to string conversion in /in/0QneW on line 12 Array
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/0QneW on line 7
Process exited with code 255.