Advertisement
ruanyf

Stack Overflow Ranking Algorithm

Mar 10th, 2012
2,368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.52 KB | None | 0 0
  1. <?php
  2.  
  3. function hot($Qviews, $Qanswers, $Qscore, $Ascores, $date_ask, $date_active)
  4. {
  5.     $Qage = (time() - strtotime(gmdate("Y-m-d H:i:s",strtotime($date_ask)))) / 3600;
  6.     $Qage = round($Qage, 1);
  7.  
  8.     $Qupdated = (time() - strtotime(gmdate("Y-m-d H:i:s",strtotime($date_active)))) / 3600;
  9.     $Qupdated = round($Qupdated, 1);
  10.  
  11.     $dividend = (log10($Qviews)*4) + (($Qanswers * $Qscore)/5) + $Ascores;
  12.     $divisor = pow((($Qage + 1) - ($Qage - $Qupdated)/2), 1.5);
  13.  
  14.     echo $dividend/$divisor . "\n";
  15. }
  16.  
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement