I'm a designing a website that orders results on its votes and ages.
I found the reddit algorithm and I think that is the best to use. However, I do not know how to implement this into php. I have searched google on how to do this but I cannot find any results. I don't know if it is just mean because I do not know exactly what I should be searching.
I know basic PHP however, is there a way of doing this in a simple way.
Is it possible to do it like this:
"SELECT * FROM table ORDER BY algorithm_here DESC";
The reddit algorithm is as follows:
Log10(Z) + ((Y*Ts)/45000) = rank
A = time posted
B = 00:00:001 am 1/1/2010
U = Up votes
D = Down votes
Ts = A-B
X = U-D
Y =
1 if x>0
0 if x=0
-1 if x<0
z = max(abs(x),1)