3v4l.org

run code in 300+ PHP versions simultaneously
<?php $url = "http://www.unl.edu/path/path/index.php?test"; $parts = parse_url($url); if (isset($parts['path'])) { $pathinfo = pathinfo($parts['path']); if (isset($pathinfo['extension'])) { $path = explode('/',$parts['path']); array_pop($path); $parts['path'] = implode('/', $path); } unset($parts['query']); unset($parts['fragment']); } print_r($parts);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 31
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 29
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 31
filename:       /in/ahKam
function name:  (null)
number of ops:  35
compiled vars:  !0 = $url, !1 = $parts, !2 = $pathinfo, !3 = $path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.unl.edu%2Fpath%2Fpath%2Findex.php%3Ftest'
    4     1        INIT_FCALL                                               'parse_url'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    6     5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'path'
          6      > JMPZ                                                     ~7, ->31
    7     7    >   INIT_FCALL                                               'pathinfo'
          8        FETCH_DIM_R                                      ~8      !1, 'path'
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
    8    12        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'extension'
         13      > JMPZ                                                     ~11, ->29
    9    14    >   INIT_FCALL                                               'explode'
         15        SEND_VAL                                                 '%2F'
         16        FETCH_DIM_R                                      ~12     !1, 'path'
         17        SEND_VAL                                                 ~12
         18        DO_ICALL                                         $13     
         19        ASSIGN                                                   !3, $13
   10    20        INIT_FCALL                                               'array_pop'
         21        SEND_REF                                                 !3
         22        DO_ICALL                                                 
   11    23        INIT_FCALL                                               'implode'
         24        SEND_VAL                                                 '%2F'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $17     
         27        ASSIGN_DIM                                               !1, 'path'
         28        OP_DATA                                                  $17
   14    29    >   UNSET_DIM                                                !1, 'query'
   15    30        UNSET_DIM                                                !1, 'fragment'
   18    31    >   INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !1
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.01 ms | 1396 KiB | 25 Q