3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [2, 1, 2, 5, 7, 1, 9, 3, 6, 8, 8]; $arr2 = [2, 1, 8, 3]; $priority = array_flip($arr2); $fallback = count($arr2); usort( $arr1, fn($a, $b) => [$priority[$a] ?? $fallback, $a] <=> [$priority[$b] ?? $fallback, $b] ); var_export($arr1);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 2, 1 => 2, 2 => 1, 3 => 1, 4 => 8, 5 => 8, 6 => 3, 7 => 5, 8 => 6, 9 => 7, 10 => 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:
158.77 ms | 405 KiB | 5 Q