| 1 drupal.inc | drupal_sort_weight($a, $b) | 
Sorts a structured array by 'weight' key (no # prefix).
Deprecated
since 1.0.0
See also
Related topics
File
- core/includes/ drupal.inc, line 1350 
- Contains constants and function wrappers for Drupal 7.x compatibility.
Code
function drupal_sort_weight($a, $b) {
  watchdog_deprecated_function('drupal', __FUNCTION__);
  $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;
}
