3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a= []; $b = 'foo'; $c = 'bar'; $a[$b][$c][] = 1; echo "Assign to left-hand side:"; print_it($a,$b,$c); echo "Assign via byref call:"; byref($a[$b][$c]); print_it($a,$b,$c); function byref(&$x) { $x[]= 2; } function print_it($a,$b,$c) { echo "\n"; echo "\n" . json_encode($a); echo "\n" . json_encode($a[$b]); echo "\n" . json_encode($a[$b][$c]); echo "\n\n"; }

preferences:
61.1 ms | 404 KiB | 5 Q