3v4l.org

run code in 300+ PHP versions simultaneously
<?php const URLS = [ "http://site.com/", "http://site.com/save", "http://site.com/save/results", "http://site.com/save/results/path", "http://site.com/path/save/results", "http://site.com/save/path", "http://site.com/path/results", "http://site.com/Crawler4", "http://site.com/Crawler", ]; $seen = []; $siteStructure = []; foreach (URLS as $url) { $domainUrl1 = parse_url($url, PHP_URL_SCHEME); $domainUrl2 = parse_url($url, PHP_URL_HOST); $domainPath = parse_url($url, PHP_URL_PATH); $paths = preg_split('/[^a-zA-Z0-9]+/', $domainPath, 0, PREG_SPLIT_NO_EMPTY); $domainUrl = $domainUrl1 . '://' . $domainUrl2; array_unshift($paths, $domainUrl); $paths = array_flip($paths); foreach ($paths as $key => $value){ if ($key != [0-9] && is_array($value) == false){ if ($value == 0){ $siteStructure[$key] = []; } elseif ($value >= 0 ){ $keybefore = $value - 1; $keys = array_keys($paths)[$keybefore]; $siteStructure[$keys] = [$key => $keybefore]; } } } } var_dump($siteStructure);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 68
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 68
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 66
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 66
Branch analysis from position: 41
2 jumps found. (Code = 46) Position 1 = 44, Position 2 = 47
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 65
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 53
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 65
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 65
Branch analysis from position: 65
Branch analysis from position: 47
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 66
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
filename:       /in/0ubvt
function name:  (null)
number of ops:  73
compiled vars:  !0 = $seen, !1 = $siteStructure, !2 = $url, !3 = $domainUrl1, !4 = $domainUrl2, !5 = $domainPath, !6 = $paths, !7 = $domainUrl, !8 = $value, !9 = $key, !10 = $keybefore, !11 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'URLS', <array>
   15     1        ASSIGN                                                   !0, <array>
   16     2        ASSIGN                                                   !1, <array>
   18     3        FETCH_CONSTANT                                   ~14     'URLS'
          4      > FE_RESET_R                                       $15     ~14, ->68
          5    > > FE_FETCH_R                                               $15, !2, ->68
   20     6    >   INIT_FCALL                                               'parse_url'
          7        SEND_VAR                                                 !2
          8        SEND_VAL                                                 0
          9        DO_ICALL                                         $16     
         10        ASSIGN                                                   !3, $16
   21    11        INIT_FCALL                                               'parse_url'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $18     
         15        ASSIGN                                                   !4, $18
   22    16        INIT_FCALL                                               'parse_url'
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 5
         19        DO_ICALL                                         $20     
         20        ASSIGN                                                   !5, $20
   24    21        INIT_FCALL                                               'preg_split'
         22        SEND_VAL                                                 '%2F%5B%5Ea-zA-Z0-9%5D%2B%2F'
         23        SEND_VAR                                                 !5
         24        SEND_VAL                                                 0
         25        SEND_VAL                                                 1
         26        DO_ICALL                                         $22     
         27        ASSIGN                                                   !6, $22
   26    28        CONCAT                                           ~24     !3, '%3A%2F%2F'
         29        CONCAT                                           ~25     ~24, !4
         30        ASSIGN                                                   !7, ~25
   27    31        INIT_FCALL                                               'array_unshift'
         32        SEND_REF                                                 !6
         33        SEND_VAR                                                 !7
         34        DO_ICALL                                                 
   28    35        INIT_FCALL                                               'array_flip'
         36        SEND_VAR                                                 !6
         37        DO_ICALL                                         $28     
         38        ASSIGN                                                   !6, $28
   30    39      > FE_RESET_R                                       $30     !6, ->66
         40    > > FE_FETCH_R                                       ~31     $30, !8, ->66
         41    >   ASSIGN                                                   !9, ~31
   31    42        IS_NOT_EQUAL                                     ~33     !9, <array>
         43      > JMPZ_EX                                          ~33     ~33, ->47
         44    >   TYPE_CHECK                                  128  ~34     !8
         45        BOOL_NOT                                         ~35     ~34
         46        BOOL                                             ~33     ~35
         47    > > JMPZ                                                     ~33, ->65
   32    48    >   IS_EQUAL                                                 !8, 0
         49      > JMPZ                                                     ~36, ->53
   34    50    >   ASSIGN_DIM                                               !1, !9
         51        OP_DATA                                                  <array>
         52      > JMP                                                      ->65
   35    53    >   IS_SMALLER_OR_EQUAL                                      0, !8
         54      > JMPZ                                                     ~38, ->65
   36    55    >   SUB                                              ~39     !8, 1
         56        ASSIGN                                                   !10, ~39
   37    57        INIT_FCALL                                               'array_keys'
         58        SEND_VAR                                                 !6
         59        DO_ICALL                                         $41     
         60        FETCH_DIM_R                                      ~42     $41, !10
         61        ASSIGN                                                   !11, ~42
   39    62        INIT_ARRAY                                       ~45     !10, !9
         63        ASSIGN_DIM                                               !1, !11
         64        OP_DATA                                                  ~45
   30    65    > > JMP                                                      ->40
         66    >   FE_FREE                                                  $30
   18    67      > JMP                                                      ->5
         68    >   FE_FREE                                                  $15
   45    69        INIT_FCALL                                               'var_dump'
         70        SEND_VAR                                                 !1
         71        DO_ICALL                                                 
         72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.77 ms | 1405 KiB | 25 Q