3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Directory { public $dir = ''; public $parts = []; } class Vhost { public $directories = []; } $vhost =' <Directory "/srv/httpd/htdocs/mydomain.com"> Options Indexes FollowSymLinks AllowOverride All Order deny,allow Allow from 127.0.0.1 Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxx Deny from all </Directory> <Directory "/srv/httpd/htdocs/myseconddomain"> Options Indexes FollowSymLinks AllowOverride All Order deny,allow Allow from 127.0.0.1 Allow from xxx.xxx.xxx.xxx Allow from xxx.xxx.xxx.xxx Deny from all </Directory> '; $matches = []; $directory = preg_match_all('/<Directory "(.*")>([\s\S]*?)<\/Directory>/', $vhost, $matches, PREG_SET_ORDER); $vhost = new Vhost; foreach ($matches as $match) { $dir = new Directory; $dir->dir = $match[1]; echo "Directory: " . $match[1] . "\n"; $lines = explode($match[2], "\n"); foreach ($lines as $line) { $parts = preg_split('/\s+/', $line); $dir->parts = $parts; } $vhost->directories[] = $dir; } //var_dump($matches);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 46
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 46
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 41
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 41
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 41
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
filename:       /in/RJWp2
function name:  (null)
number of ops:  48
compiled vars:  !0 = $vhost, !1 = $matches, !2 = $directory, !3 = $match, !4 = $dir, !5 = $lines, !6 = $line, !7 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'directory'
    5     1        ASSIGN                                                   !0, '%0A%3CDirectory+%22%2Fsrv%2Fhttpd%2Fhtdocs%2Fmydomain.com%22%3E%0A++++Options+Indexes+FollowSymLinks%0A++++AllowOverride+All%0A++++Order+deny%2Callow%0A++++Allow+from+127.0.0.1%0A++++Allow+from+xxx.xxx.xxx.xxx%0A++++Allow+from+xxx.xxx.xxx.xxx%0A++++Deny+from+all%0A%3C%2FDirectory%3E%0A%3CDirectory+%22%2Fsrv%2Fhttpd%2Fhtdocs%2Fmyseconddomain%22%3E%0A++++Options+Indexes+FollowSymLinks%0A++++AllowOverride+All%0A++++Order+deny%2Callow%0A++++Allow+from+127.0.0.1%0A++++Allow+from+xxx.xxx.xxx.xxx%0A++++Allow+from+xxx.xxx.xxx.xxx%0A++++Deny+from+all%0A%3C%2FDirectory%3E%0A%0A'
   27     2        ASSIGN                                                   !1, <array>
   28     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAL                                                 '%2F%3CDirectory+%22%28.%2A%22%29%3E%28%5B%5Cs%5CS%5D%2A%3F%29%3C%5C%2FDirectory%3E%2F'
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !1
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !2, $10
   30    10        NEW                                              $12     'Vhost'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !0, $12
   31    13      > FE_RESET_R                                       $15     !1, ->46
         14    > > FE_FETCH_R                                               $15, !3, ->46
   33    15    >   NEW                                              $16     'Directory'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !4, $16
   34    18        FETCH_DIM_R                                      ~20     !3, 1
         19        ASSIGN_OBJ                                               !4, 'dir'
         20        OP_DATA                                                  ~20
   36    21        FETCH_DIM_R                                      ~21     !3, 1
         22        CONCAT                                           ~22     'Directory%3A+', ~21
         23        CONCAT                                           ~23     ~22, '%0A'
         24        ECHO                                                     ~23
   38    25        INIT_FCALL                                               'explode'
         26        FETCH_DIM_R                                      ~24     !3, 2
         27        SEND_VAL                                                 ~24
         28        SEND_VAL                                                 '%0A'
         29        DO_ICALL                                         $25     
         30        ASSIGN                                                   !5, $25
   39    31      > FE_RESET_R                                       $27     !5, ->41
         32    > > FE_FETCH_R                                               $27, !6, ->41
   40    33    >   INIT_FCALL                                               'preg_split'
         34        SEND_VAL                                                 '%2F%5Cs%2B%2F'
         35        SEND_VAR                                                 !6
         36        DO_ICALL                                         $28     
         37        ASSIGN                                                   !7, $28
   42    38        ASSIGN_OBJ                                               !4, 'parts'
         39        OP_DATA                                                  !7
   39    40      > JMP                                                      ->32
         41    >   FE_FREE                                                  $27
   46    42        FETCH_OBJ_W                                      $31     !0, 'directories'
         43        ASSIGN_DIM                                               $31
         44        OP_DATA                                                  !4
   31    45      > JMP                                                      ->14
         46    >   FE_FREE                                                  $15
   50    47      > RETURN                                                   1

Class Directory: [no user functions]
Class Vhost: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.16 ms | 1400 KiB | 19 Q