3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a=array('title'=>'a','arr'=>[]); $b=array('title'=>'b','arr'=>[]); $b=array('title'=>'c','arr'=>[]); $arr=Array(); $map=Array(); $arr[1]=&$a; $map[0]=&$a; $map[1]=&$b; $map[2]=&$c; $map[0]['arr'][22]=&$b; //$map[1]['arr'][33]=$c; ?><h2>MAP</h2><? var_dump($map); ?><h2>ARR</h2><? var_dump($arr);
based on uWJAf
Output for 5.4.2 - 7.2.6
<h2>MAP</h2>array(3) { [0]=> &array(2) { ["title"]=> string(1) "a" ["arr"]=> array(1) { [22]=> &array(2) { ["title"]=> string(1) "c" ["arr"]=> array(0) { } } } } [1]=> &array(2) { ["title"]=> string(1) "c" ["arr"]=> array(0) { } } [2]=> &NULL } <h2>ARR</h2>array(1) { [1]=> &array(2) { ["title"]=> string(1) "a" ["arr"]=> array(1) { [22]=> &array(2) { ["title"]=> string(1) "c" ["arr"]=> array(0) { } } } } }
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/HOYpS on line 2
Process exited with code 255.