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']); } $new = http_build_url($parts); echo $new . '/';
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/UtMe2
function name:  (null)
number of ops:  38
compiled vars:  !0 = $url, !1 = $parts, !2 = $pathinfo, !3 = $path, !4 = $new
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                                         $6      
          4        ASSIGN                                                   !1, $6
    6     5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'path'
          6      > JMPZ                                                     ~8, ->31
    7     7    >   INIT_FCALL                                               'pathinfo'
          8        FETCH_DIM_R                                      ~9      !1, 'path'
          9        SEND_VAL                                                 ~9
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !2, $10
    8    12        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'extension'
         13      > JMPZ                                                     ~12, ->29
    9    14    >   INIT_FCALL                                               'explode'
         15        SEND_VAL                                                 '%2F'
         16        FETCH_DIM_R                                      ~13     !1, 'path'
         17        SEND_VAL                                                 ~13
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !3, $14
   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                                         $18     
         27        ASSIGN_DIM                                               !1, 'path'
         28        OP_DATA                                                  $18
   14    29    >   UNSET_DIM                                                !1, 'query'
   15    30        UNSET_DIM                                                !1, 'fragment'
   18    31    >   INIT_FCALL_BY_NAME                                       'http_build_url'
         32        SEND_VAR_EX                                              !1
         33        DO_FCALL                                      0  $19     
         34        ASSIGN                                                   !4, $19
   19    35        CONCAT                                           ~21     !4, '%2F'
         36        ECHO                                                     ~21
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.53 ms | 1396 KiB | 23 Q