3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* * Fill in all four below and click the blue 'eval();' button. * ------------------ */ $server_seed = "204cbf2b6c7d3df52d5fce91c83ec4f1c77614df8dd3336629c7dd5bd87ec4c5"; $public_seed = " 0929140631"; $round = "12158348"; /* ------------------ */ if ($server_seed == 'ca5add7281b8ffc170ade794600f27c4bdf91ca831608aeabe9dadf542501bc6' || $public_seed === " 0827080836" || $round == '') { echo "Fill in details"; return; } $hash = hash_hmac('sha256', $public_seed . "-" . $round, $server_seed); $decimal_hash = '0'; $length = strlen($hash); for ($i = 0; $i < $length; $i++) { $decimal_hash = bcmul($decimal_hash, '16'); // Multiply by base 16 $decimal_hash = bcadd($decimal_hash, hexdec($hash[$i])); // Add the current digit } // Apply modulo to get the roll $roll = bcmod($decimal_hash, '15'); // Use modulo 15 to get the roll 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.5.0 - 8.5.3
Fatal error: Uncaught Error: Call to undefined function bcmul() in /in/uFTrl:25 Stack trace: #0 {main} thrown in /in/uFTrl on line 25
Process exited with code 255.
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
Roll: 14 Colour: black

preferences:
40.83 ms | 700 KiB | 4 Q