drupal_sort_weight

Versions
mediamosa-21
drupal_sort_weight($a, $b)

Function used by uasort to sort structured arrays by weight, without the property weight prefix.

Code

includes/common.inc, line 5261

<?php
function drupal_sort_weight($a, $b) {
  $a_weight = (is_array($a) && isset($a['weight'])) ? $a['weight'] : 0;
  $b_weight = (is_array($b) && isset($b['weight'])) ? $b['weight'] : 0;
  if ($a_weight == $b_weight) {
    return 0;
  }
  return ($a_weight < $b_weight) ? -1 : 1;
}
?>