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"; }
Output for git.master, git.master_jit, rfc.property-hooks
Assign to left-hand side: {"foo":{"bar":[1]}} {"bar":[1]} [1] Assign via byref call: {"foo":{"bar":[1,2]}} {"bar":[1,2]} [1,2]

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.92 ms | 405 KiB | 5 Q