3v4l.org

run code in 300+ PHP versions simultaneously
<?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']);
Output for 8.3.0 - 8.3.4
----------------php5------------------ Warning: Array to string conversion in /in/5BYBW on line 6 Warning: Undefined variable $Array in /in/5BYBW on line 6 Warning: Trying to access array offset on null in /in/5BYBW on line 6 Warning: Trying to access array offset on null in /in/5BYBW on line 6 NULL ----------------php7------------------ string(5) "Young"
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
----------------php5------------------ Warning: Array to string conversion in /in/5BYBW on line 6 Warning: Undefined variable $Array in /in/5BYBW on line 6 Warning: Trying to access array offset on value of type null in /in/5BYBW on line 6 Warning: Trying to access array offset on value of type null in /in/5BYBW on line 6 NULL ----------------php7------------------ string(5) "Young"
Output for 7.4.0 - 7.4.33
----------------php5------------------ Notice: Array to string conversion in /in/5BYBW on line 6 Notice: Undefined variable: Array in /in/5BYBW on line 6 Notice: Trying to access array offset on value of type null in /in/5BYBW on line 6 Notice: Trying to access array offset on value of type null in /in/5BYBW on line 6 NULL ----------------php7------------------ string(5) "Young"
Output for 7.3.32 - 7.3.33
----------------php5------------------ NULL ----------------php7------------------ string(5) "Young"
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31
----------------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.5.24 - 5.5.35, 5.6.8 - 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

preferences:
149.56 ms | 402 KiB | 178 Q