3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [1, 4, 7, 3, 3, 3]; $array2 = [4, 0, 3, 4, 9, 9]; $counts1 = array_count_values($array1); foreach (array_count_values($array2) as $number => $count) { if ($count > ($counts1[$number] ?? 0)) { $counts1[$number] = $count; } } $result = []; foreach ($counts1 as $number => $count) { array_push($result, ...array_fill(0, $count, $number)); } var_export($result);
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:
109.23 ms | 405 KiB | 5 Q