3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [1, 4, 7, 3, 3, 3]; $array2 = [4, 0, 3, 4, 9, 9]; function min_merge($arr1, $arr2) { $arr1 = array_count_values($arr1); $arr2 = array_count_values($arr2); foreach ($arr2 as $index=>$arr) if (!isset($arr1[$index]) || $arr > $arr1[$index]) $arr1[$index] = $arr; foreach ($arr1 as $index=>$arr) for ($i=0;$i<$arr;$i++) $final[] = $index; return $final; } print_r(min_merge($array1, $array2));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 1 [1] => 4 [2] => 4 [3] => 7 [4] => 3 [5] => 3 [6] => 3 [7] => 0 [8] => 9 [9] => 9 )

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:
48.24 ms | 401 KiB | 8 Q