Trending algorithm in PHP?

I’m working on a personal project that organizes songs uploaded by the frequency of votes in a certain amount of time, and maybe some sort of base score (probably how many likes something has, or plays). I’ve seen some trending/hot algorithms, but the problem is that they have downvoting, while my system does not. Can anyone give me insight on how to perform something like this in PHP?

This is my idea so far:

$s = $row['song_stat_plays'];
$s = $s + (2 * $row['song_stat_downloads']);
$s = $s * (3 * $row['song_votes']);
$TrendScore = floor(log(max($s,1)));