3v4l.org

run code in 300+ PHP versions simultaneously
<?php function uuid($c = 4) { $x = function($c) { for ($n = ''; strlen($n) < $c + 1; $n = $n.base_convert(mt_rand(), 10, 16)); return substr($n, -$c); }; return (microtime(true) * 10000).'-'.$x($c).'-'.$x($c).'-'.$x($c).'-'.$x($c).'-'.$x($c).'-'.$x($c) ; return sprintf( '%x-%s-%s-%s-%s%s%s', microtime(true) * 10000, $x($c), $x($c), $x($c), $x($c), $x($c), $x($c) ); } $time = microtime(); $uuids = array(); for ($i = 0; $i < 100; $i++) { $uuids[] = uuid(); } if (count(array_unique($uuids)) != count($uuids)) { echo 'DUPLICATED'; } else { echo 'No duplicate'; print_r($uuids); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/kXrgS
function name:  (null)
number of ops:  27
compiled vars:  !0 = $time, !1 = $uuids, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'microtime'
          1        DO_ICALL                                         $3      
          2        ASSIGN                                                   !0, $3
   19     3        ASSIGN                                                   !1, <array>
   20     4        ASSIGN                                                   !2, 0
          5      > JMP                                                      ->11
   21     6    >   INIT_FCALL                                               'uuid'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN_DIM                                               !1
          9        OP_DATA                                                  $8
   20    10        PRE_INC                                                  !2
         11    >   IS_SMALLER                                               !2, 100
         12      > JMPNZ                                                    ~10, ->6
   24    13    >   INIT_FCALL                                               'array_unique'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $11     
         16        COUNT                                            ~12     $11
         17        COUNT                                            ~13     !1
         18        IS_NOT_EQUAL                                             ~12, ~13
         19      > JMPZ                                                     ~14, ->22
   25    20    >   ECHO                                                     'DUPLICATED'
         21      > JMP                                                      ->26
   27    22    >   ECHO                                                     'No+duplicate'
   28    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
   29    26    > > RETURN                                                   1

Function uuid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kXrgS
function name:  uuid
number of ops:  72
compiled vars:  !0 = $c, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      4
    4     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FkXrgS%3A4%240'
          2        ASSIGN                                                   !1, ~2
   10     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $4      
          6        MUL                                              ~5      $4, 10000
          7        CONCAT                                           ~6      ~5, '-'
          8        INIT_DYNAMIC_CALL                                        !1
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $7      
         11        CONCAT                                           ~8      ~6, $7
         12        CONCAT                                           ~9      ~8, '-'
         13        INIT_DYNAMIC_CALL                                        !1
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $10     
         16        CONCAT                                           ~11     ~9, $10
         17        CONCAT                                           ~12     ~11, '-'
         18        INIT_DYNAMIC_CALL                                        !1
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0  $13     
         21        CONCAT                                           ~14     ~12, $13
         22        CONCAT                                           ~15     ~14, '-'
         23        INIT_DYNAMIC_CALL                                        !1
         24        SEND_VAR_EX                                              !0
         25        DO_FCALL                                      0  $16     
         26        CONCAT                                           ~17     ~15, $16
         27        CONCAT                                           ~18     ~17, '-'
         28        INIT_DYNAMIC_CALL                                        !1
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0  $19     
         31        CONCAT                                           ~20     ~18, $19
         32        CONCAT                                           ~21     ~20, '-'
         33        INIT_DYNAMIC_CALL                                        !1
         34        SEND_VAR_EX                                              !0
         35        DO_FCALL                                      0  $22     
         36        CONCAT                                           ~23     ~21, $22
         37      > RETURN                                                   ~23
   12    38*       INIT_FCALL                                               'sprintf'
   13    39*       SEND_VAL                                                 '%25x-%25s-%25s-%25s-%25s%25s%25s'
   14    40*       INIT_FCALL                                               'microtime'
         41*       SEND_VAL                                                 <true>
         42*       DO_ICALL                                         $24     
         43*       MUL                                              ~25     $24, 10000
         44*       SEND_VAL                                                 ~25
         45*       INIT_DYNAMIC_CALL                                        !1
         46*       SEND_VAR_EX                                              !0
         47*       DO_FCALL                                      0  $26     
         48*       SEND_VAR                                                 $26
         49*       INIT_DYNAMIC_CALL                                        !1
         50*       SEND_VAR_EX                                              !0
         51*       DO_FCALL                                      0  $27     
         52*       SEND_VAR                                                 $27
         53*       INIT_DYNAMIC_CALL                                        !1
         54*       SEND_VAR_EX                                              !0
         55*       DO_FCALL                                      0  $28     
         56*       SEND_VAR                                                 $28
         57*       INIT_DYNAMIC_CALL                                        !1
         58*       SEND_VAR_EX                                              !0
         59*       DO_FCALL                                      0  $29     
         60*       SEND_VAR                                                 $29
         61*       INIT_DYNAMIC_CALL                                        !1
         62*       SEND_VAR_EX                                              !0
         63*       DO_FCALL                                      0  $30     
         64*       SEND_VAR                                                 $30
         65*       INIT_DYNAMIC_CALL                                        !1
         66*       SEND_VAR_EX                                              !0
         67*       DO_FCALL                                      0  $31     
         68*       SEND_VAR                                                 $31
         69*       DO_ICALL                                         $32     
         70*       RETURN                                                   $32
   16    71*     > RETURN                                                   null

End of function uuid

Function %00%7Bclosure%7D%2Fin%2FkXrgS%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
Branch analysis from position: 3
filename:       /in/kXrgS
function name:  {closure}
number of ops:  23
compiled vars:  !0 = $c, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
          2      > JMP                                                      ->12
          3    >   INIT_FCALL                                               'base_convert'
          4        INIT_FCALL                                               'mt_rand'
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        SEND_VAL                                                 10
          8        SEND_VAL                                                 16
          9        DO_ICALL                                         $4      
         10        CONCAT                                           ~5      !1, $4
         11        ASSIGN                                                   !1, ~5
         12    >   STRLEN                                           ~7      !1
         13        ADD                                              ~8      !0, 1
         14        IS_SMALLER                                               ~7, ~8
         15      > JMPNZ                                                    ~9, ->3
    6    16    >   INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !1
         18        MUL                                              ~10     !0, -1
         19        SEND_VAL                                                 ~10
         20        DO_ICALL                                         $11     
         21      > RETURN                                                   $11
    7    22*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FkXrgS%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.49 ms | 1407 KiB | 28 Q