3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rglob($pattern, $flags = 0) { $files = glob($pattern, $flags); foreach(glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) { $files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags)); } return $files; } foreach(rglob(getcwd().'/*', GLOB_ONLYDIR) as $f){ printf("<h1>dir: %s perms: %s writable: %s</h1><br>", $f, substr(sprintf('%o', fileperms($f)), -4), is_writable($f) ? 'True' : 'False'); }

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 34
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 34
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/MZbta
function name:  (null)
number of ops:  36
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'rglob'
          1        INIT_FCALL                                               'getcwd'
          2        DO_ICALL                                         $1      
          3        CONCAT                                           ~2      $1, '%2F%2A'
          4        SEND_VAL                                                 ~2
          5        SEND_VAL                                                 8192
          6        DO_FCALL                                      0  $3      
          7      > FE_RESET_R                                       $4      $3, ->34
          8    > > FE_FETCH_R                                               $4, !0, ->34
   11     9    >   INIT_FCALL                                               'printf'
         10        SEND_VAL                                                 '%3Ch1%3Edir%3A+%25s+perms%3A+%25s+writable%3A+%25s%3C%2Fh1%3E%3Cbr%3E'
         11        SEND_VAR                                                 !0
         12        INIT_FCALL                                               'substr'
         13        INIT_FCALL                                               'sprintf'
         14        SEND_VAL                                                 '%25o'
         15        INIT_FCALL                                               'fileperms'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $5      
         18        SEND_VAR                                                 $5
         19        DO_ICALL                                         $6      
         20        SEND_VAR                                                 $6
         21        SEND_VAL                                                 -4
         22        DO_ICALL                                         $7      
         23        SEND_VAR                                                 $7
         24        INIT_FCALL                                               'is_writable'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $8      
         27      > JMPZ                                                     $8, ->30
         28    >   QM_ASSIGN                                        ~9      'True'
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~9      'False'
         31    >   SEND_VAL                                                 ~9
         32        DO_ICALL                                                 
   10    33      > JMP                                                      ->8
         34    >   FE_FREE                                                  $4
   12    35      > RETURN                                                   1

Function rglob:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 32
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 32
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/MZbta
function name:  rglob
number of ops:  35
compiled vars:  !0 = $pattern, !1 = $flags, !2 = $files, !3 = $dir
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    4     2        INIT_FCALL                                               'glob'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
    5     7        INIT_FCALL                                               'glob'
          8        INIT_FCALL                                               'dirname'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11        CONCAT                                           ~7      $6, '%2F%2A'
         12        SEND_VAL                                                 ~7
         13        SEND_VAL                                                 8196
         14        DO_ICALL                                         $8      
         15      > FE_RESET_R                                       $9      $8, ->32
         16    > > FE_FETCH_R                                               $9, !3, ->32
    6    17    >   INIT_FCALL                                               'array_merge'
         18        SEND_VAR                                                 !2
         19        INIT_FCALL_BY_NAME                                       'rglob'
         20        CONCAT                                           ~10     !3, '%2F'
         21        INIT_FCALL                                               'basename'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $11     
         24        CONCAT                                           ~12     ~10, $11
         25        SEND_VAL_EX                                              ~12
         26        SEND_VAR_EX                                              !1
         27        DO_FCALL                                      0  $13     
         28        SEND_VAR                                                 $13
         29        DO_ICALL                                         $14     
         30        ASSIGN                                                   !2, $14
    5    31      > JMP                                                      ->16
         32    >   FE_FREE                                                  $9
    8    33      > RETURN                                                   !2
    9    34*     > RETURN                                                   null

End of function rglob

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.06 ms | 1403 KiB | 34 Q