3v4l.org

run code in 300+ PHP versions simultaneously
<?php function guidv4() { $data = file_get_contents('/dev/urandom', false, null, 0, 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/fVj1e
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/fVj1e
function name:  guidv4
number of ops:  43
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'file_get_contents'
          1        SEND_VAL                                                 '%2Fdev%2Furandom'
          2        SEND_VAL                                                 <false>
          3        SEND_VAL                                                 null
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 16
          6        DO_ICALL                                         $1      
          7        ASSIGN                                                   !0, $1
    4     8        INIT_FCALL                                               'chr'
          9        INIT_FCALL                                               'ord'
         10        FETCH_DIM_R                                      ~4      !0, 6
         11        SEND_VAL                                                 ~4
         12        DO_ICALL                                         $5      
         13        BW_AND                                           ~6      $5, 15
         14        BW_OR                                            ~7      ~6, 64
         15        SEND_VAL                                                 ~7
         16        DO_ICALL                                         $8      
         17        ASSIGN_DIM                                               !0, 6
         18        OP_DATA                                                  $8
    5    19        INIT_FCALL                                               'chr'
         20        INIT_FCALL                                               'ord'
         21        FETCH_DIM_R                                      ~10     !0, 8
         22        SEND_VAL                                                 ~10
         23        DO_ICALL                                         $11     
         24        BW_AND                                           ~12     $11, 63
         25        BW_OR                                            ~13     ~12, 128
         26        SEND_VAL                                                 ~13
         27        DO_ICALL                                         $14     
         28        ASSIGN_DIM                                               !0, 8
         29        OP_DATA                                                  $14
    6    30        INIT_FCALL                                               'vsprintf'
         31        SEND_VAL                                                 '%25s%25s-%25s-%25s-%25s-%25s%25s%25s'
         32        INIT_FCALL                                               'str_split'
         33        INIT_FCALL                                               'bin2hex'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $15     
         36        SEND_VAR                                                 $15
         37        SEND_VAL                                                 4
         38        DO_ICALL                                         $16     
         39        SEND_VAR                                                 $16
         40        DO_ICALL                                         $17     
         41      > RETURN                                                   $17
    7    42*     > RETURN                                                   null

End of function guidv4

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.42 ms | 1403 KiB | 26 Q