PHP生成0到36之间的数字可证明是公平的

I'm trying to generate a number from 0 to 36 in php that can be proven that it was fair later.

I've had a google around and found a formula that works, however I'm having a bit of trouble getting it to work in PHP.

roll_hash = hash("sha256", server_seed + "-" + lottery + "-" + roll_id);
roll_hash_first16 = substr(roll_hash, 0, 16);
roll_lucky_number = hex_to_uint64(roll_hash_first16) % 15;

is the formula I've found, however I can't get it to work in PHP.

This is the PHP code I've tried however it doesn't do what I need it to do.

$server_seed = "577701c29f6e4a409b8a607cb95c79c943146dc7dff3eb6894a34837076e7365";
$salt = "fe5e5c41b";
$roll_id = 0;

$roll_hash = hash("sha256", $server_seed + "-" + $salt + "-" + $roll_id);
$roll_hash_first16 = substr($roll_hash, 0, 36);
$roll_lucky_number = hexdec($roll_hash_first16) / 35;

This code will just generate something like "5.3687216943283E+41"

I need it to generate a plain number from 0 to 36 and which should be the same whenever the server seed, salt and roll_id are the same.

Here's the corrected version of the PHP code though:

function generateRandomNumber(string $seed, string $salt, int $roll): int
{
    $roll_hash = hash("sha256", $seed . "-" . $salt . "-" . $roll);
    $roll_hash_first16 = substr($roll_hash, 0, 16);
    return abs(hexdec($roll_hash_first16) % 37);  
}

https://3v4l.org/QMgNR