3v4l.org

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