3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ "A - 1.0 - Title Page.PDF", "A - 2.2 - Enlarged Floor Plans", "A - 2.1.0 - Structural Details.PDF", "E - 1.0 - Electrical Title Page.PDF", "A - 1.2 - Floor Plan.PDF", "P - 1.0 - Plumbing Title Page2.PDF", "A - 2.1.1 - Structural Details.PDF", "C - 1.0 - Civil Title Page.PDF", "M - 1.0 - Mechanical Title Page.PDF", "ESC - 1.0 - Erosion Control Plan.PDF", "P - 1.0 - Plumbing Title Page.PDF", ]; $priorities = array_flip(['A', 'ESC', 'C', 'M', 'E', 'P']); usort($arr, function ($a, $b) use ($priorities) { [$categoryA, $versionA, $nameA] = explode(' - ', $a, 3); [$categoryB, $versionB, $nameB] = explode(' - ', $b, 3); return $priorities[$categoryA] <=> $priorities[$categoryB] // priorities as first criteria ?: version_compare($versionB, $versionA) // then descending versions as second criteria ?: $nameA <=> $nameB; // then compare names ascending }); var_export($arr);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'A - 2.2 - Enlarged Floor Plans', 1 => 'A - 2.1.1 - Structural Details.PDF', 2 => 'A - 2.1.0 - Structural Details.PDF', 3 => 'A - 1.2 - Floor Plan.PDF', 4 => 'A - 1.0 - Title Page.PDF', 5 => 'ESC - 1.0 - Erosion Control Plan.PDF', 6 => 'C - 1.0 - Civil Title Page.PDF', 7 => 'M - 1.0 - Mechanical Title Page.PDF', 8 => 'E - 1.0 - Electrical Title Page.PDF', 9 => 'P - 1.0 - Plumbing Title Page.PDF', 10 => 'P - 1.0 - Plumbing Title Page2.PDF', )

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