So, I am doing the code below and $rolled_number
is returning -7 rather than 9. I have checked my code on http://www.phptester.net/ and the result is 9. I believe it is due to the modulo. If anyone knows why my code does not work on my local web server but does work on other sites then please tell me. My web server is using PHP 5.6 my web server is wamp
Code:
$server_seed = "161293a556787ecaee5d04de72753323c916408f2f7f0cf2c1931717480d463c";
$lottery_id = "7606271363";
$round_id = "1";
$hash = hash("sha256", $server_seed . "-" . $lottery_id . "-" . $round_id);
$rolled_number = hexdec(substr($hash, 0, 8)) % 15;
echo "Round $round_id = $rolled_number";