3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_entropy() { $ip = $_SERVER['REMOTE_ADDR']; $ip_multiplex = multiply_ip($ip); echo "IP Multiplex: $ip_multiplex | "; 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); $openssl_num = $openssl_num / $ip_multiplex; 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 + $openssl_num + $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/3rJ7A
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   77     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 = 15, Position 2 = 39
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 63
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 67, Position 2 = 87
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
Branch analysis from position: 51
Branch analysis from position: 63
Branch analysis from position: 39
filename:       /in/3rJ7A
function name:  random_entropy
number of ops:  92
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
    8     7        ROPE_INIT                                     3  ~17     'IP+Multiplex%3A+'
          8        ROPE_ADD                                      1  ~17     ~17, !1
          9        ROPE_END                                      2  ~16     ~17, '+%7C+'
         10        ECHO                                                     ~16
   10    11        INIT_FCALL                                               'function_exists'
         12        SEND_VAL                                                 'openssl_random_pseudo_bytes'
         13        DO_ICALL                                         $19     
         14      > JMPZ                                                     $19, ->39
   12    15    >   INIT_FCALL                                               'time'
         16        DO_ICALL                                         $20     
         17        ASSIGN                                                   !2, $20
   13    18        MOD                                              ~22     !2, 32
         19        ASSIGN                                                   !2, ~22
   14    20        INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
         21        SEND_VAR_EX                                              !2
         22        SEND_VAR_EX                                              !4
         23        DO_FCALL                                      0  $24     
         24        ASSIGN                                                   !3, $24
   15    25        INIT_FCALL                                               'bin2hex'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $26     
         28        ASSIGN                                                   !5, $26
   16    29        INIT_FCALL                                               'hexdec'
         30        SEND_VAR                                                 !5
         31        DO_ICALL                                         $28     
         32        ASSIGN                                                   !6, $28
   17    33        DIV                                              ~30     !6, !1
         34        ASSIGN                                                   !6, ~30
   18    35        ROPE_INIT                                     3  ~33     'openssl%3A+'
         36        ROPE_ADD                                      1  ~33     ~33, !6
         37        ROPE_END                                      2  ~32     ~33, '+%7C+'
         38        ECHO                                                     ~32
   21    39    >   INIT_FCALL                                               'function_exists'
         40        SEND_VAL                                                 'random_bytes'
         41        DO_ICALL                                         $35     
         42      > JMPZ                                                     $35, ->63
   23    43    >   INIT_FCALL                                               'time'
         44        DO_ICALL                                         $36     
         45        ASSIGN                                                   !2, $36
   24    46        MOD                                              ~38     !2, 8
         47        ASSIGN                                                   !2, ~38
   25    48        IS_EQUAL                                                 !2, 0
         49      > JMPZ                                                     ~40, ->51
   27    50    >   ASSIGN                                                   !2, 3
   30    51    >   INIT_FCALL                                               'random_bytes'
         52        SEND_VAR                                                 !2
         53        DO_ICALL                                         $42     
         54        ASSIGN                                                   !7, $42
   31    55        INIT_FCALL                                               'bindec'
         56        SEND_VAR                                                 !7
         57        DO_ICALL                                         $44     
         58        ASSIGN                                                   !7, $44
   32    59        ROPE_INIT                                     3  ~47     'Rand+Num%3A+'
         60        ROPE_ADD                                      1  ~47     ~47, !7
         61        ROPE_END                                      2  ~46     ~47, '+%7C+'
         62        ECHO                                                     ~46
   35    63    >   INIT_FCALL                                               'function_exists'
         64        SEND_VAL                                                 'mt_rand'
         65        DO_ICALL                                         $49     
         66      > JMPZ                                                     $49, ->87
   37    67    >   INIT_FCALL                                               'time'
         68        DO_ICALL                                         $50     
         69        ASSIGN                                                   !2, $50
   38    70        MOD                                              ~52     !2, 4
         71        ASSIGN                                                   !8, ~52
   39    72        MOD                                              ~54     !2, 8
         73        ASSIGN                                                   !9, ~54
   40    74        INIT_FCALL                                               'mt_rand'
         75        SEND_VAR                                                 !8
         76        SEND_VAR                                                 !9
         77        DO_ICALL                                         $56     
         78        ASSIGN                                                   !10, $56
   41    79        ADD                                              ~58     !10, !9
         80        DIV                                              ~59     ~58, !8
         81        ASSIGN                                                   !10, ~59
   42    82        ROPE_INIT                                     3  ~62     'MT+Rand+Num%3A+'
         83        ROPE_ADD                                      1  ~62     ~62, !10
         84        ROPE_END                                      2  ~61     ~62, '+'
         85        CONCAT                                           ~64     ~61, '%0A'
         86        ECHO                                                     ~64
   45    87    >   ADD                                              ~65     !1, !6
         88        ADD                                              ~66     ~65, !7
         89        ADD                                              ~67     ~66, !10
         90      > RETURN                                                   ~67
   47    91*     > 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/3rJ7A
function name:  microtime_float
number of ops:  16
compiled vars:  !0 = $usec, !1 = $sec
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     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
   56    11        CAST                                          5  ~8      !0
         12        CAST                                          5  ~9      !1
         13        ADD                                              ~10     ~8, ~9
         14      > RETURN                                                   ~10
   57    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/3rJ7A
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
-------------------------------------------------------------------------------------
   59     0  E >   RECV                                             !0      
   61     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '.'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   62     6        ASSIGN                                                   !2, 1
   64     7      > FE_RESET_R                                       $7      !1, ->17
          8    > > FE_FETCH_R                                               $7, !3, ->17
   66     9    >   IS_EQUAL                                                 !3, 0
         10      > JMPZ                                                     ~8, ->14
   68    11    >   INIT_FCALL                                               'microtime_float'
         12        DO_FCALL                                      0  $9      
         13        ASSIGN                                                   !3, $9
   71    14    >   MUL                                              ~11     !2, !3
         15        ASSIGN                                                   !2, ~11
   64    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $7
   74    18        INIT_FCALL                                               'round'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $13     
         21      > RETURN                                                   $13
   75    22*     > RETURN                                                   null

End of function multiply_ip

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.61 ms | 1411 KiB | 35 Q