3v4l.org

run code in 300+ PHP versions simultaneously
<?php $salt = "fe5e5c41b"; $roll_id = 2; for($i = 0; $i < 1000; $i++) { echo generateRandomNumber(md5(uniqid(rand(), true)), $salt, 0) . "\r\n"; } 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); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 4
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 4
Branch analysis from position: 23
Branch analysis from position: 4
filename:       /in/QMgNR
function name:  (null)
number of ops:  24
compiled vars:  !0 = $salt, !1 = $roll_id, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'fe5e5c41b'
    3     1        ASSIGN                                                   !1, 2
    5     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->21
    6     4    >   INIT_FCALL_BY_NAME                                       'generateRandomNumber'
          5        INIT_FCALL                                               'md5'
          6        INIT_FCALL                                               'uniqid'
          7        INIT_FCALL                                               'rand'
          8        DO_ICALL                                         $6      
          9        SEND_VAR                                                 $6
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $7      
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                         $8      
         14        SEND_VAR_NO_REF_EX                                       $8
         15        SEND_VAR_EX                                              !0
         16        SEND_VAL_EX                                              0
         17        DO_FCALL                                      0  $9      
         18        CONCAT                                           ~10     $9, '%0D%0A'
         19        ECHO                                                     ~10
    5    20        PRE_INC                                                  !2
         21    >   IS_SMALLER                                               !2, 1000
         22      > JMPNZ                                                    ~12, ->4
   14    23    > > RETURN                                                   1

Function generaterandomnumber:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QMgNR
function name:  generateRandomNumber
number of ops:  29
compiled vars:  !0 = $seed, !1 = $salt, !2 = $roll, !3 = $roll_hash, !4 = $roll_hash_first16
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   11     3        INIT_FCALL                                               'hash'
          4        SEND_VAL                                                 'sha256'
          5        CONCAT                                           ~5      !0, '-'
          6        CONCAT                                           ~6      ~5, !1
          7        CONCAT                                           ~7      ~6, '-'
          8        CONCAT                                           ~8      ~7, !2
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !3, $9
   12    12        INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !3
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 16
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !4, $11
   13    18        INIT_FCALL                                               'abs'
         19        INIT_FCALL                                               'hexdec'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $13     
         22        MOD                                              ~14     $13, 37
         23        SEND_VAL                                                 ~14
         24        DO_ICALL                                         $15     
         25        VERIFY_RETURN_TYPE                                       $15
         26      > RETURN                                                   $15
   14    27*       VERIFY_RETURN_TYPE                                       
         28*     > RETURN                                                   null

End of function generaterandomnumber

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.69 ms | 1405 KiB | 27 Q