3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [1, 3, 3, 3, 4, 7, 7, 8, 8]; $array2 = [0, 3, 3, 4, 4, 9, 9, 9]; $counts1 = array_count_values($array1); $counts2 = array_count_values($array2); $allCounts = $counts1 + $counts2; $result = []; array_walk( $allCounts, function($v, $k) use(&$counts1, &$counts2, &$result) { array_push( $result, ...array_fill( 0, max($counts1[$k] ?? 0, $counts2[$k] ?? 0), $k ) ); } ); var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 1, 1 => 3, 2 => 3, 3 => 3, 4 => 4, 5 => 4, 6 => 7, 7 => 7, 8 => 8, 9 => 8, 10 => 0, 11 => 9, 12 => 9, 13 => 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:
29.33 ms | 405 KiB | 5 Q