3v4l.org

run code in 300+ PHP versions simultaneously
<?php function treeList($path = "") { $prefix = ($path == "") ? $_SERVER['DOCUMENT_ROOT'] : ""; $return = preg_replace("#(.*)/(.*)$#u","\$1",$path); echo ' <ul> '; echo ' <li><a href="?path='.$return.'">[...назад...]</a></li> '; foreach (glob($_SERVER['DOCUMENT_ROOT']."$path/*") as $item) { $isdir = (is_dir($item)) ? true : false; $item = str_replace(array($_SERVER['DOCUMENT_ROOT'],"//"),array("","/"),$item); if ($isdir) echo ' <li><b><a href="?path='.$item.'">'.$item.'</a></b></li> '; else echo ' <li>'.$item.'</li> '; } echo ' </ul> '; } $path = (isset($_GET['path'])) ? $_GET['path'] : ""; header("Content-Type: text/html; charset=utf-8"); treeList($path);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nSLvQ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   FETCH_IS                                         ~1      '_GET'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, 'path'
          2      > JMPZ                                                     ~2, ->7
          3    >   FETCH_R                      global              ~3      '_GET'
          4        FETCH_DIM_R                                      ~4      ~3, 'path'
          5        QM_ASSIGN                                        ~5      ~4
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~5      ''
          8    >   ASSIGN                                                   !0, ~5
   32     9        INIT_FCALL                                               'header'
         10        SEND_VAL                                                 'Content-Type%3A+text%2Fhtml%3B+charset%3Dutf-8'
         11        DO_ICALL                                                 
   34    12        INIT_FCALL                                               'treelist'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function treelist:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 58
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 58
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 54
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 54
Branch analysis from position: 48
Branch analysis from position: 54
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 58
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 58
Branch analysis from position: 28
Branch analysis from position: 58
filename:       /in/nSLvQ
function name:  treeList
number of ops:  61
compiled vars:  !0 = $path, !1 = $prefix, !2 = $return, !3 = $item, !4 = $isdir
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      ''
    4     1        IS_EQUAL                                                 !0, ''
          2      > JMPZ                                                     ~5, ->7
          3    >   FETCH_R                      global              ~6      '_SERVER'
          4        FETCH_DIM_R                                      ~7      ~6, 'DOCUMENT_ROOT'
          5        QM_ASSIGN                                        ~8      ~7
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~8      ''
          8    >   ASSIGN                                                   !1, ~8
    6     9        INIT_FCALL                                               'preg_replace'
         10        SEND_VAL                                                 '%23%28.%2A%29%2F%28.%2A%29%24%23u'
         11        SEND_VAL                                                 '%241'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
    8    15        ECHO                                                     '+%3Cul%3E+'
   10    16        CONCAT                                           ~12     '+%3Cli%3E%3Ca+href%3D%22%3Fpath%3D', !2
         17        CONCAT                                           ~13     ~12, '%22%3E%5B...%D0%BD%D0%B0%D0%B7%D0%B0%D0%B4...%5D%3C%2Fa%3E%3C%2Fli%3E+'
         18        ECHO                                                     ~13
   12    19        INIT_FCALL                                               'glob'
         20        FETCH_R                      global              ~14     '_SERVER'
         21        FETCH_DIM_R                                      ~15     ~14, 'DOCUMENT_ROOT'
         22        NOP                                                      
         23        FAST_CONCAT                                      ~16     !0, '%2F%2A'
         24        CONCAT                                           ~17     ~15, ~16
         25        SEND_VAL                                                 ~17
         26        DO_ICALL                                         $18     
         27      > FE_RESET_R                                       $19     $18, ->58
         28    > > FE_FETCH_R                                               $19, !3, ->58
   14    29    >   INIT_FCALL                                               'is_dir'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $20     
         32      > JMPZ                                                     $20, ->35
         33    >   QM_ASSIGN                                        ~21     <true>
         34      > JMP                                                      ->36
         35    >   QM_ASSIGN                                        ~21     <false>
         36    >   ASSIGN                                                   !4, ~21
   16    37        INIT_FCALL                                               'str_replace'
         38        FETCH_R                      global              ~23     '_SERVER'
         39        FETCH_DIM_R                                      ~24     ~23, 'DOCUMENT_ROOT'
         40        INIT_ARRAY                                       ~25     ~24
         41        ADD_ARRAY_ELEMENT                                ~25     '%2F%2F'
         42        SEND_VAL                                                 ~25
         43        SEND_VAL                                                 <array>
         44        SEND_VAR                                                 !3
         45        DO_ICALL                                         $26     
         46        ASSIGN                                                   !3, $26
   18    47      > JMPZ                                                     !4, ->54
         48    >   CONCAT                                           ~28     '+%3Cli%3E%3Cb%3E%3Ca+href%3D%22%3Fpath%3D', !3
         49        CONCAT                                           ~29     ~28, '%22%3E'
         50        CONCAT                                           ~30     ~29, !3
         51        CONCAT                                           ~31     ~30, '%3C%2Fa%3E%3C%2Fb%3E%3C%2Fli%3E+'
         52        ECHO                                                     ~31
         53      > JMP                                                      ->57
   20    54    >   CONCAT                                           ~32     '+%3Cli%3E', !3
         55        CONCAT                                           ~33     ~32, '%3C%2Fli%3E+'
         56        ECHO                                                     ~33
   12    57    > > JMP                                                      ->28
         58    >   FE_FREE                                                  $19
   24    59        ECHO                                                     '+%3C%2Ful%3E+'
   26    60      > RETURN                                                   null

End of function treelist

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.48 ms | 1407 KiB | 24 Q