3v4l.org

run code in 300+ PHP versions simultaneously
<?php $range = "INSERT MAX BET NUMBER"; //----------------Insert between the quotes the number of latest bet made within block 499,999 $blockhash = "INSERT HASH OF BLOCK #500.000"; //-----Insert between the quotes the hash of block number 500.000 $hash = hash('sha256', $blockhash); //--------------Create sha256 hash from block hash $hex = substr($hash, 0, 8); //----------------------Take first 8 characters $dec = hexdec($hex); //-----------------------------From hexadecimal to decimal number (max possible number: 4294967295) $random = ($dec * ($range - 1)) / 4294967295; //----Reduce max possible number to $range number $winner = round($random) + 1; //--------------------Transform number to INT and avoid number 0 echo "The winner of 0.01 BTC is the bet number: " . $winner; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JBrO
function name:  (null)
number of ops:  29
compiled vars:  !0 = $range, !1 = $blockhash, !2 = $hash, !3 = $hex, !4 = $dec, !5 = $random, !6 = $winner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'INSERT+MAX+BET+NUMBER'
    5     1        ASSIGN                                                   !1, 'INSERT+HASH+OF+BLOCK+%23500.000'
    7     2        INIT_FCALL                                               'hash'
          3        SEND_VAL                                                 'sha256'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $9      
          6        ASSIGN                                                   !2, $9
    9     7        INIT_FCALL                                               'substr'
          8        SEND_VAR                                                 !2
          9        SEND_VAL                                                 0
         10        SEND_VAL                                                 8
         11        DO_ICALL                                         $11     
         12        ASSIGN                                                   !3, $11
   11    13        INIT_FCALL                                               'hexdec'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !4, $13
   13    17        SUB                                              ~15     !0, 1
         18        MUL                                              ~16     !4, ~15
         19        DIV                                              ~17     ~16, 4294967295
         20        ASSIGN                                                   !5, ~17
   15    21        INIT_FCALL                                               'round'
         22        SEND_VAR                                                 !5
         23        DO_ICALL                                         $19     
         24        ADD                                              ~20     $19, 1
         25        ASSIGN                                                   !6, ~20
   17    26        CONCAT                                           ~22     'The+winner+of+0.01+BTC+is+the+bet+number%3A+', !6
         27        ECHO                                                     ~22
   19    28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.02 ms | 1395 KiB | 21 Q