Created
June 26, 2012 13:18
-
-
Save skinofstars/2995747 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we have two counters, so we can tie people while still incrementing the pos | |
$rank = 1; | |
$pos_count = 1; | |
// set the initial visit count | |
$visit_count = $leaderboard[0]['visit_count']; | |
foreach ($leaderboard as $lUser) { | |
if ($lUser['visit_count'] != $visit_count) { | |
$visit_count = $lUser['visit_count']; | |
$rank = $pos_count; | |
} | |
$leaderboard[$pos_count-1]['rank'] = $rank; | |
$pos_count++; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment