3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tickets = array( array( 'id' => 13, 'owner' => 'jachim', 'time' => '2009-09-25 10:39:42.011612', 'project' => 'jachim.be', 'title' => 'Some random ticket' ), array( 'id' => 31, 'owner' => 'jachim', 'time' => '2009-09-24 14:38:47.945020', 'project' => 'joggink.be', 'title' => 'Some other random ticket' ), array( 'id' => 22, 'owner' => 'root', 'time' => '2009-09-24 10:58:02.904198', 'project' => 'joggink.be', 'title' => 'A specific ticket' ) ); function msort($array, $key, $sort_flags = SORT_REGULAR) { if (is_array($array) && count($array) > 0) { if (!empty($key)) { $mapping = array(); foreach ($array as $k => $v) { $sort_key = ''; if (!is_array($key)) { $sort_key = $v[$key]; } else { // @TODO This should be fixed, now it will be sorted as string foreach ($key as $key_key) { $sort_key .= $v[$key_key]; } $sort_flags = SORT_STRING; } $mapping[$k] = $sort_key; } asort($mapping, $sort_flags); $sorted = array(); foreach ($mapping as $k => $v) { $sorted[] = $array[$k]; } return $sorted; } } return $array; } //var_dump($tickets); $tickets = msort($tickets, array('id')); var_dump($tickets); ?>
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [0]=> array(5) { ["id"]=> int(13) ["owner"]=> string(6) "jachim" ["time"]=> string(26) "2009-09-25 10:39:42.011612" ["project"]=> string(9) "jachim.be" ["title"]=> string(18) "Some random ticket" } [1]=> array(5) { ["id"]=> int(22) ["owner"]=> string(4) "root" ["time"]=> string(26) "2009-09-24 10:58:02.904198" ["project"]=> string(10) "joggink.be" ["title"]=> string(17) "A specific ticket" } [2]=> array(5) { ["id"]=> int(31) ["owner"]=> string(6) "jachim" ["time"]=> string(26) "2009-09-24 14:38:47.945020" ["project"]=> string(10) "joggink.be" ["title"]=> string(24) "Some other random ticket" } }

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