3v4l.org

run code in 500+ 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:  57
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        FRAMELESS_ICALL_1                dechex              ~28     !5
         43        ASSIGN                                                       !5, ~28
   13    44        INIT_FCALL                                                   'hex2bin'
         45        SEND_VAR                                                     !5
         46        DO_ICALL                                             $30     
         47        ASSIGN                                                       !5, $30
   14    48        INIT_FCALL                                                   'base64_encode'
         49        SEND_VAR                                                     !5
         50        DO_ICALL                                             $32     
         51        ASSIGN                                                       !5, $32
   15    52        FRAMELESS_ICALL_3                str_replace         ~34     <array>, <array>
         53        OP_DATA                                                      !5
         54        ASSIGN                                                       !5, ~34
   17    55      > RETURN                                                       !5
   18    56*     > RETURN                                                       null

End of function generate

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.07 ms | 2629 KiB | 26 Q