You are here

function advpoll_compare in Advanced Poll 7.3

Same name and namespace in other branches
  1. 7 includes/advpoll_voteapi.inc \advpoll_compare()
  2. 7.2 includes/advpoll_voteapi.inc \advpoll_compare()

Callback for usort to order items by percentage.

1 string reference to 'advpoll_compare'
advpoll_calculate_percentage in includes/advpoll_voteapi.inc
Return keyed array with percentages for each index.

File

includes/advpoll_voteapi.inc, line 199
Advanced Poll Vote API Include.

Code

function advpoll_compare($a, $b) {
  if ($a['percentage'] > $b['percentage']) {
    return 1;
  }
  elseif ($a['percentage'] < $b['percentage']) {
    return -1;
  }
  else {
    return 0;
  }
}