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) { ['scheme' => $scheme, 'host' => $host, 'path' => $path] = parse_url($url); $realm = $scheme . '://' . $host; $siteStructure[$realm] = isset($siteStructure[$realm]) ? $siteStructure[$realm]: []; $current = &$siteStructure[$realm]; $pathEls = preg_split('/[^a-zA-Z0-9]+/', $path, 0, PREG_SPLIT_NO_EMPTY); foreach ($pathEls as $el) { $current[$el] = isset($current[$el]) ? $current[$el] : []; $current = &$current[$el]; } unset($current); } var_dump($siteStructure);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 52
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 52
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 49
Branch analysis from position: 37
2 jumps found. (Code = 78) Position 1 = 38, Position 2 = 49
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 49
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 37, Position 2 = 49
Branch analysis from position: 37
Branch analysis from position: 49
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
filename:       /in/AkGdV
function name:  (null)
number of ops:  57
compiled vars:  !0 = $seen, !1 = $siteStructure, !2 = $url, !3 = $scheme, !4 = $host, !5 = $path, !6 = $realm, !7 = $current, !8 = $pathEls, !9 = $el
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                                   ~12     'URLS'
          4      > FE_RESET_R                                       $13     ~12, ->52
          5    > > FE_FETCH_R                                               $13, !2, ->52
   20     6    >   INIT_FCALL                                               'parse_url'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $14     
          9        FETCH_LIST_R                                     $15     $14, 'scheme'
         10        ASSIGN                                                   !3, $15
         11        FETCH_LIST_R                                     $17     $14, 'host'
         12        ASSIGN                                                   !4, $17
         13        FETCH_LIST_R                                     $19     $14, 'path'
         14        ASSIGN                                                   !5, $19
         15        FREE                                                     $14
   22    16        CONCAT                                           ~21     !3, '%3A%2F%2F'
         17        CONCAT                                           ~22     ~21, !4
         18        ASSIGN                                                   !6, ~22
   23    19        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !6
         20      > JMPZ                                                     ~25, ->24
         21    >   FETCH_DIM_R                                      ~26     !1, !6
         22        QM_ASSIGN                                        ~27     ~26
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~27     <array>
         25    >   ASSIGN_DIM                                               !1, !6
         26        OP_DATA                                                  ~27
   24    27        FETCH_DIM_W                                      $28     !1, !6
         28        ASSIGN_REF                                               !7, $28
   26    29        INIT_FCALL                                               'preg_split'
         30        SEND_VAL                                                 '%2F%5B%5Ea-zA-Z0-9%5D%2B%2F'
         31        SEND_VAR                                                 !5
         32        SEND_VAL                                                 0
         33        SEND_VAL                                                 1
         34        DO_ICALL                                         $30     
         35        ASSIGN                                                   !8, $30
   28    36      > FE_RESET_R                                       $32     !8, ->49
         37    > > FE_FETCH_R                                               $32, !9, ->49
   30    38    >   ISSET_ISEMPTY_DIM_OBJ                         0          !7, !9
         39      > JMPZ                                                     ~34, ->43
         40    >   FETCH_DIM_R                                      ~35     !7, !9
         41        QM_ASSIGN                                        ~36     ~35
         42      > JMP                                                      ->44
         43    >   QM_ASSIGN                                        ~36     <array>
         44    >   ASSIGN_DIM                                               !7, !9
         45        OP_DATA                                                  ~36
   31    46        FETCH_DIM_W                                      $37     !7, !9
         47        ASSIGN_REF                                               !7, $37
   28    48      > JMP                                                      ->37
         49    >   FE_FREE                                                  $32
   34    50        UNSET_CV                                                 !7
   18    51      > JMP                                                      ->5
         52    >   FE_FREE                                                  $13
   37    53        INIT_FCALL                                               'var_dump'
         54        SEND_VAR                                                 !1
         55        DO_ICALL                                                 
         56      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.52 ms | 1400 KiB | 19 Q