3v4l.org

run code in 300+ PHP versions simultaneously
<?php function uuid($c = 4) { $x4 = function($c) { for ($n = ''; strlen($n) < $c + 1; $n = $n.mt_rand()); return substr($n, -$c); }; return sprintf( '%s-%04d-%04d-%04d-%04d%04d%04d', time(), $x($c), $x($c), $x($c), $x($c), $x($c), $x($c), $x($c) ); } echo uuid();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9ttt4
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'uuid'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function uuid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9ttt4
function name:  uuid
number of ops:  39
compiled vars:  !0 = $c, !1 = $x4, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      4
    4     1        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          2        ASSIGN                                                   !1, ~3
    8     3        INIT_FCALL                                               'sprintf'
    9     4        SEND_VAL                                                 '%25s-%2504d-%2504d-%2504d-%2504d%2504d%2504d'
   10     5        INIT_FCALL                                               'time'
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        INIT_DYNAMIC_CALL                                        !2
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        INIT_DYNAMIC_CALL                                        !2
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0  $7      
         15        SEND_VAR                                                 $7
         16        INIT_DYNAMIC_CALL                                        !2
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        INIT_DYNAMIC_CALL                                        !2
         21        SEND_VAR_EX                                              !0
         22        DO_FCALL                                      0  $9      
         23        SEND_VAR                                                 $9
         24        INIT_DYNAMIC_CALL                                        !2
         25        SEND_VAR_EX                                              !0
         26        DO_FCALL                                      0  $10     
         27        SEND_VAR                                                 $10
         28        INIT_DYNAMIC_CALL                                        !2
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0  $11     
         31        SEND_VAR                                                 $11
         32        INIT_DYNAMIC_CALL                                        !2
         33        SEND_VAR_EX                                              !0
         34        DO_FCALL                                      0  $12     
         35        SEND_VAR                                                 $12
    8    36        DO_ICALL                                         $13     
   10    37      > RETURN                                                   $13
   12    38*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/9ttt4
function name:  {closure}
number of ops:  18
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                                                      ->7
          3    >   INIT_FCALL                                               'mt_rand'
          4        DO_ICALL                                         $3      
          5        CONCAT                                           ~4      !1, $3
          6        ASSIGN                                                   !1, ~4
          7    >   STRLEN                                           ~6      !1
          8        ADD                                              ~7      !0, 1
          9        IS_SMALLER                                               ~6, ~7
         10      > JMPNZ                                                    ~8, ->3
    6    11    >   INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !1
         13        MUL                                              ~9      !0, -1
         14        SEND_VAL                                                 ~9
         15        DO_ICALL                                         $10     
         16      > RETURN                                                   $10
    7    17*     > RETURN                                                   null

End of Dynamic Function 0

End of function uuid

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.73 ms | 1470 KiB | 18 Q