3v4l.org

run code in 300+ PHP versions simultaneously
<?php function guidv4() { $data = openssl_random_pseudo_bytes(16); $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } echo guidv4();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3kL6
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'guidv4'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function guidv4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3kL6
function name:  guidv4
number of ops:  39
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'openssl_random_pseudo_bytes'
          1        SEND_VAL_EX                                              16
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
    4     4        INIT_FCALL                                               'chr'
          5        INIT_FCALL                                               'ord'
          6        FETCH_DIM_R                                      ~4      !0, 6
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9        BW_AND                                           ~6      $5, 15
         10        BW_OR                                            ~7      ~6, 64
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                         $8      
         13        ASSIGN_DIM                                               !0, 6
         14        OP_DATA                                                  $8
    5    15        INIT_FCALL                                               'chr'
         16        INIT_FCALL                                               'ord'
         17        FETCH_DIM_R                                      ~10     !0, 8
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                         $11     
         20        BW_AND                                           ~12     $11, 63
         21        BW_OR                                            ~13     ~12, 128
         22        SEND_VAL                                                 ~13
         23        DO_ICALL                                         $14     
         24        ASSIGN_DIM                                               !0, 8
         25        OP_DATA                                                  $14
    6    26        INIT_FCALL                                               'vsprintf'
         27        SEND_VAL                                                 '%25s%25s-%25s-%25s-%25s-%25s%25s%25s'
         28        INIT_FCALL                                               'str_split'
         29        INIT_FCALL                                               'bin2hex'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $15     
         32        SEND_VAR                                                 $15
         33        SEND_VAL                                                 4
         34        DO_ICALL                                         $16     
         35        SEND_VAR                                                 $16
         36        DO_ICALL                                         $17     
         37      > RETURN                                                   $17
    7    38*     > RETURN                                                   null

End of function guidv4

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.25 ms | 1394 KiB | 24 Q