3v4l.org

run code in 300+ PHP versions simultaneously
<?php $server_seed = "c492c352632b2c1a2ad658c695077a5fd338e4dbb5ed3b8c77d7a00857012fbe"; $public_seed = "9316595"; $round = "9316617"; $hash = hash('sha256', $server_seed . "-" . $public_seed . "-" . $round); $roll = hexdec(substr($hash, 0, 8)) % 15; if ($roll == 0) $roll_colour = 'bonus'; elseif ($roll >= 1 and $roll <= 7) $roll_colour = 'T'; elseif ($roll >= 8 and $roll <= 14) $roll_colour = 'CT'; echo("Roll: $roll\nColour: $roll_colour");
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.16, 8.3.0 - 8.3.3
Roll: 14 Colour: CT

preferences:
72.07 ms | 402 KiB | 54 Q