3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_files($path){ $folder = opendir($path); while ($dat = readdir($folder)){ if ($dat != "." && $dat != ".." && (is_dir($path."/".$dat) || substr($dat,-3) == "jpg" || substr($dat,-3) == "gif" || substr($dat,-3) == "bmp" || substr($dat,-3) == "png")){ if (is_dir($path."/".$dat)){ $dirs[] = get_files($path."/".$dat); } else{ $files[] = $path."/".$dat; } } } for ($i=0; $i<sizeof($dirs); $i++){ $files2 = array_merge($files2,$dirs[$i]); } $array = array_merge($files,$files2); return $array; } $path = "http://www.hi-web.ch/"; // Pfad zum Startverzeichnis $amount = sizeof(get_files($path)); for ($i=0; $i < $amount; $i++){ $files = get_files($path); $size += filesize($files[$i]); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 8
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 8
Branch analysis from position: 20
Branch analysis from position: 8
filename:       /in/Vk1vB
function name:  (null)
number of ops:  21
compiled vars:  !0 = $path, !1 = $amount, !2 = $i, !3 = $files, !4 = $size
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.hi-web.ch%2F'
   28     1        INIT_FCALL                                               'get_files'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $6      
          4        COUNT                                            ~7      $6
          5        ASSIGN                                                   !1, ~7
   30     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->18
   31     8    >   INIT_FCALL                                               'get_files'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !3, $10
   32    12        INIT_FCALL                                               'filesize'
         13        FETCH_DIM_R                                      ~12     !3, !2
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16        ASSIGN_OP                                     1          !4, $13
   30    17        PRE_INC                                                  !2
         18    >   IS_SMALLER                                               !2, !1
         19      > JMPNZ                                                    ~16, ->8
   33    20    > > RETURN                                                   1

Function get_files:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 6
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 81, Position 2 = 71
Branch analysis from position: 81
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
2 jumps found. (Code = 44) Position 1 = 81, Position 2 = 71
Branch analysis from position: 81
Branch analysis from position: 71
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 45
Branch analysis from position: 11
2 jumps found. (Code = 47) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 31, Position 2 = 37
Branch analysis from position: 31
2 jumps found. (Code = 47) Position 1 = 38, Position 2 = 44
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 64
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 60
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 69, Position 2 = 6
Branch analysis from position: 69
Branch analysis from position: 6
Branch analysis from position: 64
Branch analysis from position: 44
Branch analysis from position: 37
Branch analysis from position: 30
Branch analysis from position: 23
Branch analysis from position: 45
Branch analysis from position: 10
filename:       /in/Vk1vB
function name:  get_files
number of ops:  88
compiled vars:  !0 = $path, !1 = $folder, !2 = $dat, !3 = $dirs, !4 = $files, !5 = $i, !6 = $files2, !7 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'opendir'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $8      
          4        ASSIGN                                                   !1, $8
    4     5      > JMP                                                      ->64
    5     6    >   IS_NOT_EQUAL                                     ~10     !2, '.'
          7      > JMPZ_EX                                          ~10     ~10, ->10
          8    >   IS_NOT_EQUAL                                     ~11     !2, '..'
          9        BOOL                                             ~10     ~11
         10    > > JMPZ_EX                                          ~10     ~10, ->45
         11    >   INIT_FCALL                                               'is_dir'
         12        CONCAT                                           ~12     !0, '%2F'
         13        CONCAT                                           ~13     ~12, !2
         14        SEND_VAL                                                 ~13
         15        DO_ICALL                                         $14     
         16      > JMPNZ_EX                                         ~15     $14, ->23
    6    17    >   INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 -3
         20        DO_ICALL                                         $16     
         21        IS_EQUAL                                         ~17     $16, 'jpg'
         22        BOOL                                             ~15     ~17
         23    > > JMPNZ_EX                                         ~15     ~15, ->30
         24    >   INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !2
         26        SEND_VAL                                                 -3
         27        DO_ICALL                                         $18     
         28        IS_EQUAL                                         ~19     $18, 'gif'
         29        BOOL                                             ~15     ~19
         30    > > JMPNZ_EX                                         ~15     ~15, ->37
         31    >   INIT_FCALL                                               'substr'
         32        SEND_VAR                                                 !2
         33        SEND_VAL                                                 -3
         34        DO_ICALL                                         $20     
         35        IS_EQUAL                                         ~21     $20, 'bmp'
         36        BOOL                                             ~15     ~21
         37    > > JMPNZ_EX                                         ~15     ~15, ->44
    7    38    >   INIT_FCALL                                               'substr'
         39        SEND_VAR                                                 !2
         40        SEND_VAL                                                 -3
         41        DO_ICALL                                         $22     
         42        IS_EQUAL                                         ~23     $22, 'png'
         43        BOOL                                             ~15     ~23
         44    >   BOOL                                             ~10     ~15
         45    > > JMPZ                                                     ~10, ->64
    8    46    >   INIT_FCALL                                               'is_dir'
         47        CONCAT                                           ~24     !0, '%2F'
         48        CONCAT                                           ~25     ~24, !2
         49        SEND_VAL                                                 ~25
         50        DO_ICALL                                         $26     
         51      > JMPZ                                                     $26, ->60
    9    52    >   INIT_FCALL_BY_NAME                                       'get_files'
         53        CONCAT                                           ~28     !0, '%2F'
         54        CONCAT                                           ~29     ~28, !2
         55        SEND_VAL_EX                                              ~29
         56        DO_FCALL                                      0  $30     
         57        ASSIGN_DIM                                               !3
         58        OP_DATA                                                  $30
         59      > JMP                                                      ->64
   12    60    >   CONCAT                                           ~32     !0, '%2F'
         61        CONCAT                                           ~33     ~32, !2
         62        ASSIGN_DIM                                               !4
         63        OP_DATA                                                  ~33
    4    64    >   INIT_FCALL                                               'readdir'
         65        SEND_VAR                                                 !1
         66        DO_ICALL                                         $34     
         67        ASSIGN                                           ~35     !2, $34
         68      > JMPNZ                                                    ~35, ->6
   16    69    >   ASSIGN                                                   !5, 0
         70      > JMP                                                      ->78
   17    71    >   INIT_FCALL                                               'array_merge'
         72        SEND_VAR                                                 !6
         73        FETCH_DIM_R                                      ~37     !3, !5
         74        SEND_VAL                                                 ~37
         75        DO_ICALL                                         $38     
         76        ASSIGN                                                   !6, $38
   16    77        PRE_INC                                                  !5
         78    >   COUNT                                            ~41     !3
         79        IS_SMALLER                                               !5, ~41
         80      > JMPNZ                                                    ~42, ->71
   20    81    >   INIT_FCALL                                               'array_merge'
         82        SEND_VAR                                                 !4
         83        SEND_VAR                                                 !6
         84        DO_ICALL                                         $43     
         85        ASSIGN                                                   !7, $43
   21    86      > RETURN                                                   !7
   22    87*     > RETURN                                                   null

End of function get_files

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.24 ms | 1406 KiB | 27 Q