3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rglob($pattern, $flags = 0, $path = '') { if (!$path && ($dir = dirname($pattern)) != '.') { if ($dir == '\\' || $dir == '/') $dir = ''; return rglob(basename($pattern), $flags, $dir . '/'); } $paths = glob($path . '*', GLOB_ONLYDIR | GLOB_NOSORT); $files = glob($path . $pattern, $flags); foreach ($paths as $p) $files = array_merge($files, rglob($pattern, $flags, $p . '/')); return $files; } $fileList = rglob("*", GLOB_MARK, '/etc/'); foreach($fileList as $index => $file) { if($file[strlen($file) - 1] != "/") { echo "f: ".$file."\n"; } else echo "d: ".$file."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 22
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/kV9R7
function name:  (null)
number of ops:  24
compiled vars:  !0 = $fileList, !1 = $file, !2 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'rglob'
          1        SEND_VAL                                                 '%2A'
          2        SEND_VAL                                                 2
          3        SEND_VAL                                                 '%2Fetc%2F'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
   16     6      > FE_RESET_R                                       $5      !0, ->22
          7    > > FE_FETCH_R                                       ~6      $5, !1, ->22
          8    >   ASSIGN                                                   !2, ~6
   17     9        STRLEN                                           ~8      !1
         10        SUB                                              ~9      ~8, 1
         11        FETCH_DIM_R                                      ~10     !1, ~9
         12        IS_NOT_EQUAL                                             ~10, '%2F'
         13      > JMPZ                                                     ~11, ->18
   19    14    >   CONCAT                                           ~12     'f%3A+', !1
         15        CONCAT                                           ~13     ~12, '%0A'
         16        ECHO                                                     ~13
         17      > JMP                                                      ->21
   20    18    >   CONCAT                                           ~14     'd%3A+', !1
         19        CONCAT                                           ~15     ~14, '%0A'
         20        ECHO                                                     ~15
   16    21    > > JMP                                                      ->7
         22    >   FE_FREE                                                  $5
   21    23      > RETURN                                                   1

Function rglob:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 47) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 16
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 41, Position 2 = 54
Branch analysis from position: 41
2 jumps found. (Code = 78) Position 1 = 42, Position 2 = 54
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
Branch analysis from position: 11
filename:       /in/kV9R7
function name:  rglob
number of ops:  57
compiled vars:  !0 = $pattern, !1 = $flags, !2 = $path, !3 = $dir, !4 = $paths, !5 = $files, !6 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
          2        RECV_INIT                                        !2      ''
    4     3        BOOL_NOT                                         ~7      !2
          4      > JMPZ_EX                                          ~7      ~7, ->11
          5    >   INIT_FCALL                                               'dirname'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        ASSIGN                                           ~9      !3, $8
          9        IS_NOT_EQUAL                                     ~10     ~9, '.'
         10        BOOL                                             ~7      ~10
         11    > > JMPZ                                                     ~7, ->28
    5    12    >   IS_EQUAL                                         ~11     !3, '%5C'
         13      > JMPNZ_EX                                         ~11     ~11, ->16
         14    >   IS_EQUAL                                         ~12     !3, '%2F'
         15        BOOL                                             ~11     ~12
         16    > > JMPZ                                                     ~11, ->18
         17    >   ASSIGN                                                   !3, ''
    6    18    >   INIT_FCALL_BY_NAME                                       'rglob'
         19        INIT_FCALL                                               'basename'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $14     
         22        SEND_VAR_NO_REF_EX                                       $14
         23        SEND_VAR_EX                                              !1
         24        CONCAT                                           ~15     !3, '%2F'
         25        SEND_VAL_EX                                              ~15
         26        DO_FCALL                                      0  $16     
         27      > RETURN                                                   $16
    8    28    >   INIT_FCALL                                               'glob'
         29        CONCAT                                           ~17     !2, '%2A'
         30        SEND_VAL                                                 ~17
         31        SEND_VAL                                                 8196
         32        DO_ICALL                                         $18     
         33        ASSIGN                                                   !4, $18
    9    34        INIT_FCALL                                               'glob'
         35        CONCAT                                           ~20     !2, !0
         36        SEND_VAL                                                 ~20
         37        SEND_VAR                                                 !1
         38        DO_ICALL                                         $21     
         39        ASSIGN                                                   !5, $21
   10    40      > FE_RESET_R                                       $23     !4, ->54
         41    > > FE_FETCH_R                                               $23, !6, ->54
         42    >   INIT_FCALL                                               'array_merge'
         43        SEND_VAR                                                 !5
         44        INIT_FCALL_BY_NAME                                       'rglob'
         45        SEND_VAR_EX                                              !0
         46        SEND_VAR_EX                                              !1
         47        CONCAT                                           ~24     !6, '%2F'
         48        SEND_VAL_EX                                              ~24
         49        DO_FCALL                                      0  $25     
         50        SEND_VAR                                                 $25
         51        DO_ICALL                                         $26     
         52        ASSIGN                                                   !5, $26
         53      > JMP                                                      ->41
         54    >   FE_FREE                                                  $23
   11    55      > RETURN                                                   !5
   12    56*     > RETURN                                                   null

End of function rglob

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.24 ms | 1406 KiB | 22 Q