3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tmp1 = ['foo' => [['a' => 'a1Value', 'b' => 'b1Value'], ['a' => 'a1Value', 'b' => 'b1Value']]]; $tmp2 = ['foo' => [['a' => 'a1Value', 'b' => 'b1Value'], ['a' => 'a1Value', 'b' => 'b1Value']]]; foreach ($tmp1['foo'] as &$v) { unset($v['b']); } foreach ($tmp2['foo'] ?? [] as &$v) { unset($v['b']); } var_dump($tmp1); var_dump($tmp2);
Output for git.master, git.master_jit
array(1) { ["foo"]=> array(2) { [0]=> array(1) { ["a"]=> string(7) "a1Value" } [1]=> array(1) { ["a"]=> string(7) "a1Value" } } } array(1) { ["foo"]=> array(2) { [0]=> array(2) { ["a"]=> string(7) "a1Value" ["b"]=> string(7) "b1Value" } [1]=> array(2) { ["a"]=> string(7) "a1Value" ["b"]=> string(7) "b1Value" } } }

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:
32.59 ms | 406 KiB | 5 Q