3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = floor(microtime(true) * 1000); function generate($time) { $prefix_length = random_int(1, 18); $prefix = random_int(0, bindec(str_repeat('1', $prefix_length))); $suffix_length = 18 - $prefix_length; $suffix = random_int(0, bindec(str_repeat('1', $suffix_length))); $uid = 1 << 45 + $prefix_length + $suffix_length | $prefix << 45 + $suffix_length | $time << $suffix_length | $suffix; $uid = dechex($uid); $uid = hex2bin($uid); $uid = base64_encode($uid); $uid = str_replace(['=', '+', '/'], ['', '-', '_'], $uid); return $uid; } var_dump(generate($time)); var_dump(generate($time)); var_dump(generate($time)); var_dump(generate($time)); var_dump(generate($time));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W3no0
function name:  (null)
number of ops:  39
compiled vars:  !0 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'floor'
          1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $1      
          4        MUL                                              ~2      $1, 1000
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
   20     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'generate'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
   21    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'generate'
         16        SEND_VAR                                                 !0
         17        DO_FCALL                                      0  $7      
         18        SEND_VAR                                                 $7
         19        DO_ICALL                                                 
   22    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'generate'
         22        SEND_VAR                                                 !0
         23        DO_FCALL                                      0  $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                                 
   23    26        INIT_FCALL                                               'var_dump'
         27        INIT_FCALL                                               'generate'
         28        SEND_VAR                                                 !0
         29        DO_FCALL                                      0  $11     
         30        SEND_VAR                                                 $11
         31        DO_ICALL                                                 
   24    32        INIT_FCALL                                               'var_dump'
         33        INIT_FCALL                                               'generate'
         34        SEND_VAR                                                 !0
         35        DO_FCALL                                      0  $13     
         36        SEND_VAR                                                 $13
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Function generate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/W3no0
function name:  generate
number of ops:  62
compiled vars:  !0 = $time, !1 = $prefix_length, !2 = $prefix, !3 = $suffix_length, !4 = $suffix, !5 = $uid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'random_int'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 18
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
    7     6        INIT_FCALL                                               'random_int'
          7        SEND_VAL                                                 0
          8        INIT_FCALL                                               'bindec'
          9        INIT_FCALL                                               'str_repeat'
         10        SEND_VAL                                                 '1'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $8      
         13        SEND_VAR                                                 $8
         14        DO_ICALL                                         $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                         $10     
         17        ASSIGN                                                   !2, $10
    8    18        SUB                                              ~12     18, !1
         19        ASSIGN                                                   !3, ~12
    9    20        INIT_FCALL                                               'random_int'
         21        SEND_VAL                                                 0
         22        INIT_FCALL                                               'bindec'
         23        INIT_FCALL                                               'str_repeat'
         24        SEND_VAL                                                 '1'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $14     
         27        SEND_VAR                                                 $14
         28        DO_ICALL                                         $15     
         29        SEND_VAR                                                 $15
         30        DO_ICALL                                         $16     
         31        ASSIGN                                                   !4, $16
   11    32        ADD                                              ~18     45, !1
         33        ADD                                              ~19     ~18, !3
         34        SL                                               ~20     1, ~19
         35        ADD                                              ~21     45, !3
         36        SL                                               ~22     !2, ~21
         37        BW_OR                                            ~23     ~20, ~22
         38        SL                                               ~24     !0, !3
         39        BW_OR                                            ~25     ~23, ~24
         40        BW_OR                                            ~26     !4, ~25
         41        ASSIGN                                                   !5, ~26
   12    42        INIT_FCALL                                               'dechex'
         43        SEND_VAR                                                 !5
         44        DO_ICALL                                         $28     
         45        ASSIGN                                                   !5, $28
   13    46        INIT_FCALL                                               'hex2bin'
         47        SEND_VAR                                                 !5
         48        DO_ICALL                                         $30     
         49        ASSIGN                                                   !5, $30
   14    50        INIT_FCALL                                               'base64_encode'
         51        SEND_VAR                                                 !5
         52        DO_ICALL                                         $32     
         53        ASSIGN                                                   !5, $32
   15    54        INIT_FCALL                                               'str_replace'
         55        SEND_VAL                                                 <array>
         56        SEND_VAL                                                 <array>
         57        SEND_VAR                                                 !5
         58        DO_ICALL                                         $34     
         59        ASSIGN                                                   !5, $34
   17    60      > RETURN                                                   !5
   18    61*     > RETURN                                                   null

End of function generate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.19 ms | 1407 KiB | 38 Q