Calculating an unknown variable
View Single Post
05-20-2008, 12:08 AM
Join Date: Apr 2007
OK, looks like there may be a rounding problem on your machine or version of PHP (mine's 5.2.5). Simply round the value rather than casting it to integer.
$rounds = round(log($players, 2)); // 6
As a fun check try:
echo (int) 5.999999999999999;
that's what PHP might be seeing rather than 6 as we expect.
View Public Profile
Send a private message to Salathe
Visit Salathe's homepage!
Find More Posts by Salathe