Skip to content

Instantly share code, notes, and snippets.

@putzflorian
Created June 5, 2013 18:14
Show Gist options
  • Select an option

  • Save putzflorian/5715950 to your computer and use it in GitHub Desktop.

Select an option

Save putzflorian/5715950 to your computer and use it in GitHub Desktop.
Array Multisort
<?
$test = array();
$test[0] = array('trest' => 'hallo', 'rime' => 15);
$test[2] = array('trest' => 'hallo', 'rime' => 15);
$test[3] = array('trest' => 'hallo', 'rime' => 2);
$test[4] = array('trest' => 'hallo', 'rime' => 5);
$sortArray = array();
foreach($test as $key => $array) {
$sortArray[$key] = $array['rime'];
}
array_multisort($sortArray, SORT_DESC, SORT_NUMERIC, $test);
p_r($test);
die();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment