3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( array ('Q1',2017), array ('Q3',2017), array ('Q3',2012), array ('Q4',2015), array ('Q4',2017), array ('Q2',2017), ); $new = array(); foreach($arr as $subarr){ $new[$subarr[1]][] = $subarr[0]; sort($new[$subarr[1]]); } ksort($new); $finalarr = array(); foreach($new as $key => $val){ foreach($val as $k=>$v){ $finalarr[] = array($v, $key); } } echo "<pre>"; print_r($finalarr);
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [0] => Q3 [1] => 2012 ) [1] => Array ( [0] => Q4 [1] => 2015 ) [2] => Array ( [0] => Q1 [1] => 2017 ) [3] => Array ( [0] => Q2 [1] => 2017 ) [4] => Array ( [0] => Q3 [1] => 2017 ) [5] => Array ( [0] => Q4 [1] => 2017 ) )

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:
64.58 ms | 402 KiB | 8 Q