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 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(10); } 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 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
Branch analysis from position: 6
filename:       /in/AnRDY
function name:  (null)
number of ops:  28
compiled vars:  !0 = $time, !1 = $uuids, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'microtime'
          1        DO_ICALL                                         $3      
          2        ASSIGN                                                   !0, $3
   15     3        ASSIGN                                                   !1, <array>
   16     4        ASSIGN                                                   !2, 0
          5      > JMP                                                      ->12
   17     6    >   INIT_FCALL                                               'uuid'
          7        SEND_VAL                                                 10
          8        DO_FCALL                                      0  $8      
          9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  $8
   16    11        PRE_INC                                                  !2
         12    >   IS_SMALLER                                               !2, 100
         13      > JMPNZ                                                    ~10, ->6
   20    14    >   INIT_FCALL                                               'array_unique'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $11     
         17        COUNT                                            ~12     $11
         18        COUNT                                            ~13     !1
         19        IS_NOT_EQUAL                                             ~12, ~13
         20      > JMPZ                                                     ~14, ->23
   21    21    >   ECHO                                                     'DUPLICATED'
         22      > JMP                                                      ->27
   23    23    >   ECHO                                                     'No+duplicate'
   24    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
   25    27    > > RETURN                                                   1

Function uuid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AnRDY
function name:  uuid
number of ops:  37
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%2FAnRDY%3A4%240'
          2        ASSIGN                                                   !1, ~2
    8     3        INIT_FCALL                                               'sprintf'
    9     4        SEND_VAL                                                 '%25x-%25s-%25s-%25s-%25s%25s%25s'
   10     5        INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $4      
          8        MUL                                              ~5      $4, 10000
          9        SEND_VAL                                                 ~5
         10        INIT_DYNAMIC_CALL                                        !1
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        INIT_DYNAMIC_CALL                                        !1
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $7      
         17        SEND_VAR                                                 $7
         18        INIT_DYNAMIC_CALL                                        !1
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0  $8      
         21        SEND_VAR                                                 $8
         22        INIT_DYNAMIC_CALL                                        !1
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $9      
         25        SEND_VAR                                                 $9
         26        INIT_DYNAMIC_CALL                                        !1
         27        SEND_VAR_EX                                              !0
         28        DO_FCALL                                      0  $10     
         29        SEND_VAR                                                 $10
         30        INIT_DYNAMIC_CALL                                        !1
         31        SEND_VAR_EX                                              !0
         32        DO_FCALL                                      0  $11     
         33        SEND_VAR                                                 $11
         34        DO_ICALL                                         $12     
         35      > RETURN                                                   $12
   12    36*     > RETURN                                                   null

End of function uuid

Function %00%7Bclosure%7D%2Fin%2FAnRDY%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/AnRDY
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%2FAnRDY%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.73 ms | 1398 KiB | 28 Q