3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ ['month' => 1], ['month' => 2], ['month' => 3], ['month' => 4] ]; $arr2 = [ ['month' => 3, 'info' => 'Alpha'], ['month' => 4, 'info' => 'Beta'], ['month' => 1, 'info' => 'Gamma'], ]; $arr1 = array_column($arr1, null, 'month'); $arr2 = array_column($arr2, null, 'month'); $result = array_replace($arr1, $arr2); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [1]=> array(2) { ["month"]=> int(1) ["info"]=> string(5) "Gamma" } [2]=> array(1) { ["month"]=> int(2) } [3]=> array(2) { ["month"]=> int(3) ["info"]=> string(5) "Alpha" } [4]=> array(2) { ["month"]=> int(4) ["info"]=> string(4) "Beta" } }

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