3v4l.org

run code in 300+ PHP versions simultaneously
<?php $server_seed ="c847a04db629e7621b2fd409ad1d8a8286f5091e6976a832df38caee2c4dd871"; $public_seed = "460670512935"; $round = "462"; $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 = 'orange'; elseif ($roll >= 8 and $roll <= 14) $roll_colour = 'black'; echo("Roll: $roll\nColour: $roll_colour");
Output for 8.1.0 - 8.1.29, 8.2.0 - 8.2.21, 8.3.0 - 8.3.9
Roll: 6 Colour: orange

preferences:
64.01 ms | 403 KiB | 67 Q