3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $bar = 'php5'; $foo['bar']['baz'] = 'Jason'; echo $$foo['bar']['baz']; //php5 = $($foo['bar']['baz']) = $Jason = Young; echo "\n----------------php7 down------------------\n"; $bar = 'php7'; $Jason = ['bar'=>['baz'=>'Young']]; var_dump($Jason); echo $$foo['bar']['baz'];
based on pSlWn
Output for 7.0.0 - 7.2.0
Notice: Array to string conversion in /in/M9EV9 on line 4 Notice: Undefined variable: Array in /in/M9EV9 on line 4 ----------------php7 down------------------ array(1) { ["bar"]=> array(1) { ["baz"]=> string(5) "Young" } } Notice: Array to string conversion in /in/M9EV9 on line 13 Notice: Undefined variable: Array in /in/M9EV9 on line 13
Output for 5.4.11 - 5.6.28
Notice: Undefined variable: Jason in /in/M9EV9 on line 4 ----------------php7 down------------------ array(1) { ["bar"]=> array(1) { ["baz"]=> string(5) "Young" } } Notice: Array to string conversion in /in/M9EV9 on line 13 Array
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/M9EV9 on line 11
Process exited with code 255.