3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "\n----------------php5------------------\n"; $php5 = 'Jason'; $foo['bar']['baz'] = 'php5'; var_dump($$foo['bar']['baz']); echo "\n----------------php7------------------\n"; $bar = 'php7'; $php7['bar']['baz'] = 'Young'; var_dump($$bar['bar']['baz']);
based on a1dr8
Output for 7.0.0 - 7.2.0
----------------php5------------------ Notice: Array to string conversion in /in/5BYBW on line 6 Notice: Undefined variable: Array in /in/5BYBW on line 6 NULL ----------------php7------------------ string(5) "Young"
Output for 5.4.11 - 5.6.21
----------------php5------------------ string(5) "Jason" ----------------php7------------------ Warning: Illegal string offset 'bar' in /in/5BYBW on line 12 Warning: Illegal string offset 'baz' in /in/5BYBW on line 12 Notice: Undefined variable: p in /in/5BYBW on line 12 NULL
Output for 5.3.21 - 5.3.29
----------------php5------------------ string(5) "Jason" ----------------php7------------------ Fatal error: Cannot use string offset as an array in /in/5BYBW on line 12
Process exited with code 255.