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); $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/Lh0F1
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   72     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 = 54
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 78
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
Branch analysis from position: 54
Branch analysis from position: 33
filename:       /in/Lh0F1
function name:  random_entropy
number of ops:  82
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, ->54
   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        INIT_FCALL                                               'random_bytes'
         43        SEND_VAR                                                 !2
         44        DO_ICALL                                         $35     
         45        ASSIGN                                                   !7, $35
   24    46        INIT_FCALL                                               'bindec'
         47        SEND_VAR                                                 !7
         48        DO_ICALL                                         $37     
         49        ASSIGN                                                   !7, $37
   25    50        ROPE_INIT                                     3  ~40     'Rand+Num%3A+'
         51        ROPE_ADD                                      1  ~40     ~40, !7
         52        ROPE_END                                      2  ~39     ~40, '+%7C+'
         53        ECHO                                                     ~39
   28    54    >   INIT_FCALL                                               'function_exists'
         55        SEND_VAL                                                 'mt_rand'
         56        DO_ICALL                                         $42     
         57      > JMPZ                                                     $42, ->78
   30    58    >   INIT_FCALL                                               'time'
         59        DO_ICALL                                         $43     
         60        ASSIGN                                                   !2, $43
   31    61        MOD                                              ~45     !2, 4
         62        ASSIGN                                                   !8, ~45
   32    63        MOD                                              ~47     !2, 8
         64        ASSIGN                                                   !9, ~47
   33    65        INIT_FCALL                                               'mt_rand'
         66        SEND_VAR                                                 !8
         67        SEND_VAR                                                 !9
         68        DO_ICALL                                         $49     
         69        ASSIGN                                                   !10, $49
   34    70        ADD                                              ~51     !10, !9
         71        DIV                                              ~52     ~51, !8
         72        ASSIGN                                                   !10, ~52
   35    73        ROPE_INIT                                     3  ~55     'MT+Rand+Num%3A+'
         74        ROPE_ADD                                      1  ~55     ~55, !10
         75        ROPE_END                                      2  ~54     ~55, '+'
         76        CONCAT                                           ~57     ~54, '%0A'
         77        ECHO                                                     ~57
   38    78    >   ADD                                              ~58     !1, !7
         79        ADD                                              ~59     ~58, !10
         80      > RETURN                                                   ~59
   40    81*     > 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/Lh0F1
function name:  microtime_float
number of ops:  16
compiled vars:  !0 = $usec, !1 = $sec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     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
   51    11        CAST                                          5  ~8      !0
         12        CAST                                          5  ~9      !1
         13        ADD                                              ~10     ~8, ~9
         14      > RETURN                                                   ~10
   52    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/Lh0F1
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
-------------------------------------------------------------------------------------
   54     0  E >   RECV                                             !0      
   56     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   57     6        ASSIGN                                                   !2, 1
   59     7      > FE_RESET_R                                       $7      !1, ->17
          8    > > FE_FETCH_R                                               $7, !3, ->17
   61     9    >   IS_EQUAL                                                 !3, 0
         10      > JMPZ                                                     ~8, ->14
   63    11    >   INIT_FCALL                                               'microtime_float'
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !3, $9
   66    14    >   MUL                                              ~11     !2, !3
         15        ASSIGN                                                   !2, ~11
   59    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $7
   69    18        INIT_FCALL                                               'round'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $13     
         21      > RETURN                                                   $13
   70    22*     > RETURN                                                   null

End of function multiply_ip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.35 ms | 1411 KiB | 35 Q