3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['ref' => 'Q1'], ['ref' => 'C6'], ['ref' => 'C13'], ['ref' => 'S3'], ['ref' => 'Q11'], 8 => ['ref' => 'S7'], 9 => ['ref' => 'C4'], ]; $map = array_flip( ['S', 'Q', 'D', 'C', 'P', 'E'] ); foreach ($array as $keys[] => ['ref' => $v]) { sscanf($v, '%1s%d', $letter, $integers[]); $priorities[] = $map[$letter]; } array_multisort( $priorities, $integers, $array ); var_export(array_combine($keys, $array));
Output for git.master_jit, git.master
array ( 0 => array ( 'ref' => 'S3', ), 1 => array ( 'ref' => 'S7', ), 2 => array ( 'ref' => 'Q1', ), 3 => array ( 'ref' => 'Q11', ), 4 => array ( 'ref' => 'C4', ), 8 => array ( 'ref' => 'C6', ), 9 => array ( 'ref' => 'C13', ), )

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