3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_entropy() { $ip = $_SERVER['REMOTE_ADDR']; $ip_multiplex = multiply_ip($ip); if(function_exists('openssl_random_pseudo_bytes')) { $i = time(); $i = ($i % 32); $bytes = openssl_random_pseudo_bytes($i, $cstrong); $hex = bin2hex($bytes); $openssl_num = hexdec($hex); echo "openssl: $openssl_num | "; } if(function_exists('random_bytes')) { $i = time(); $i = ($i % 8); if($i == 0) { $i = 3; } $rand_num = random_bytes($i); $rand_num = bindec($rand_num); echo "Rand Num: $rand_num | "; } if(function_exists('mt_rand')) { $i = time(); $i_min = ($i % 4); $i_max = ($i % 8); $mt_rand_num = mt_rand($i_min, $i_max); $mt_rand_num = ($mt_rand_num + $i_max) / $i_min; echo "MT Rand Num: $mt_rand_num " . PHP_EOL; } return $ip_multiplex + $rand_num + $mt_rand_num; } function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function multiply_ip($ip) { $ip_array = explode('.', $ip); $number = 1; foreach($ip_array as $node) { if($node == 0) { $node = microtime_float(); } $number = $number * $node; } return round($number); } echo random_entropy();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ud65D
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   75     0  E >   INIT_FCALL                                               'random_entropy'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function random_entropy:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 33
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 57
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 45
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 81
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 81
Branch analysis from position: 45
Branch analysis from position: 57
Branch analysis from position: 33
filename:       /in/ud65D
function name:  random_entropy
number of ops:  85
compiled vars:  !0 = $ip, !1 = $ip_multiplex, !2 = $i, !3 = $bytes, !4 = $cstrong, !5 = $hex, !6 = $openssl_num, !7 = $rand_num, !8 = $i_min, !9 = $i_max, !10 = $mt_rand_num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_R                      global              ~11     '_SERVER'
          1        FETCH_DIM_R                                      ~12     ~11, 'REMOTE_ADDR'
          2        ASSIGN                                                   !0, ~12
    7     3        INIT_FCALL_BY_NAME                                       'multiply_ip'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $14     
          6        ASSIGN                                                   !1, $14
    9     7        INIT_FCALL                                               'function_exists'
          8        SEND_VAL                                                 'openssl_random_pseudo_bytes'
          9        DO_ICALL                                         $16     
         10      > JMPZ                                                     $16, ->33
   11    11    >   INIT_FCALL                                               'time'
         12        DO_ICALL                                         $17     
         13        ASSIGN                                                   !2, $17
   12    14        MOD                                              ~19     !2, 32
         15        ASSIGN                                                   !2, ~19
   13    16        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         17        SEND_VAR_EX                                              !2
         18        SEND_VAR_EX                                              !4
         19        DO_FCALL                                      0  $21     
         20        ASSIGN                                                   !3, $21
   14    21        INIT_FCALL                                               'bin2hex'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $23     
         24        ASSIGN                                                   !5, $23
   15    25        INIT_FCALL                                               'hexdec'
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                         $25     
         28        ASSIGN                                                   !6, $25
   16    29        ROPE_INIT                                     3  ~28     'openssl%3A+'
         30        ROPE_ADD                                      1  ~28     ~28, !6
         31        ROPE_END                                      2  ~27     ~28, '+%7C+'
         32        ECHO                                                     ~27
   19    33    >   INIT_FCALL                                               'function_exists'
         34        SEND_VAL                                                 'random_bytes'
         35        DO_ICALL                                         $30     
         36      > JMPZ                                                     $30, ->57
   21    37    >   INIT_FCALL                                               'time'
         38        DO_ICALL                                         $31     
         39        ASSIGN                                                   !2, $31
   22    40        MOD                                              ~33     !2, 8
         41        ASSIGN                                                   !2, ~33
   23    42        IS_EQUAL                                                 !2, 0
         43      > JMPZ                                                     ~35, ->45
   25    44    >   ASSIGN                                                   !2, 3
   28    45    >   INIT_FCALL                                               'random_bytes'
         46        SEND_VAR                                                 !2
         47        DO_ICALL                                         $37     
         48        ASSIGN                                                   !7, $37
   29    49        INIT_FCALL                                               'bindec'
         50        SEND_VAR                                                 !7
         51        DO_ICALL                                         $39     
         52        ASSIGN                                                   !7, $39
   30    53        ROPE_INIT                                     3  ~42     'Rand+Num%3A+'
         54        ROPE_ADD                                      1  ~42     ~42, !7
         55        ROPE_END                                      2  ~41     ~42, '+%7C+'
         56        ECHO                                                     ~41
   33    57    >   INIT_FCALL                                               'function_exists'
         58        SEND_VAL                                                 'mt_rand'
         59        DO_ICALL                                         $44     
         60      > JMPZ                                                     $44, ->81
   35    61    >   INIT_FCALL                                               'time'
         62        DO_ICALL                                         $45     
         63        ASSIGN                                                   !2, $45
   36    64        MOD                                              ~47     !2, 4
         65        ASSIGN                                                   !8, ~47
   37    66        MOD                                              ~49     !2, 8
         67        ASSIGN                                                   !9, ~49
   38    68        INIT_FCALL                                               'mt_rand'
         69        SEND_VAR                                                 !8
         70        SEND_VAR                                                 !9
         71        DO_ICALL                                         $51     
         72        ASSIGN                                                   !10, $51
   39    73        ADD                                              ~53     !10, !9
         74        DIV                                              ~54     ~53, !8
         75        ASSIGN                                                   !10, ~54
   40    76        ROPE_INIT                                     3  ~57     'MT+Rand+Num%3A+'
         77        ROPE_ADD                                      1  ~57     ~57, !10
         78        ROPE_END                                      2  ~56     ~57, '+'
         79        CONCAT                                           ~59     ~56, '%0A'
         80        ECHO                                                     ~59
   43    81    >   ADD                                              ~60     !1, !7
         82        ADD                                              ~61     ~60, !10
         83      > RETURN                                                   ~61
   45    84*     > RETURN                                                   null

End of function random_entropy

Function microtime_float:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ud65D
function name:  microtime_float
number of ops:  16
compiled vars:  !0 = $usec, !1 = $sec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   INIT_FCALL                                               'explode'
          1        SEND_VAL                                                 '+'
          2        INIT_FCALL                                               'microtime'
          3        DO_ICALL                                         $2      
          4        SEND_VAR                                                 $2
          5        DO_ICALL                                         $3      
          6        FETCH_LIST_R                                     $4      $3, 0
          7        ASSIGN                                                   !0, $4
          8        FETCH_LIST_R                                     $6      $3, 1
          9        ASSIGN                                                   !1, $6
         10        FREE                                                     $3
   54    11        CAST                                          5  ~8      !0
         12        CAST                                          5  ~9      !1
         13        ADD                                              ~10     ~8, ~9
         14      > RETURN                                                   ~10
   55    15*     > RETURN                                                   null

End of function microtime_float

Function multiply_ip:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/ud65D
function name:  multiply_ip
number of ops:  23
compiled vars:  !0 = $ip, !1 = $ip_array, !2 = $number, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   RECV                                             !0      
   59     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   60     6        ASSIGN                                                   !2, 1
   62     7      > FE_RESET_R                                       $7      !1, ->17
          8    > > FE_FETCH_R                                               $7, !3, ->17
   64     9    >   IS_EQUAL                                                 !3, 0
         10      > JMPZ                                                     ~8, ->14
   66    11    >   INIT_FCALL                                               'microtime_float'
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !3, $9
   69    14    >   MUL                                              ~11     !2, !3
         15        ASSIGN                                                   !2, ~11
   62    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $7
   72    18        INIT_FCALL                                               'round'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $13     
         21      > RETURN                                                   $13
   73    22*     > RETURN                                                   null

End of function multiply_ip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
258.62 ms | 1411 KiB | 36 Q