3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $anotherarr = array('b' => 'B'); $arr = array(); $arr['a'] = 'A'; $arr['b1'] =& $anotherarr['b']; $arr['b2'] =& $arr['d']; $arr['c'] = 'C'; $arr['d'] = 'D'; var_dump($arr);
based on RQrpY
Output for 5.3.20 - 5.6.28, 7.1.0 - 7.2.0
array(5) { ["a"]=> string(1) "A" ["b1"]=> &string(1) "B" ["d"]=> &string(1) "D" ["b2"]=> &string(1) "D" ["c"]=> string(1) "C" }
Output for 7.0.0 - 7.0.20
array(5) { ["a"]=> string(1) "A" ["b1"]=> &string(1) "B" ["b2"]=> &string(1) "D" ["d"]=> &string(1) "D" ["c"]=> string(1) "C" }