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'])) { $parts['path'] = implode('/',array_pop(explode('/',$parts['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 = 30
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 30
filename:       /in/F9bIm
function name:  (null)
number of ops:  34
compiled vars:  !0 = $url, !1 = $parts, !2 = $pathinfo
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                                         $4      
          4        ASSIGN                                                   !1, $4
    6     5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, 'path'
          6      > JMPZ                                                     ~6, ->30
    7     7    >   INIT_FCALL                                               'pathinfo'
          8        FETCH_DIM_R                                      ~7      !1, 'path'
          9        SEND_VAL                                                 ~7
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !2, $8
    8    12        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'extension'
         13      > JMPZ                                                     ~10, ->28
    9    14    >   INIT_FCALL                                               'implode'
         15        SEND_VAL                                                 '%2F'
         16        INIT_FCALL                                               'array_pop'
         17        INIT_FCALL                                               'explode'
         18        SEND_VAL                                                 '%2F'
         19        FETCH_DIM_R                                      ~12     !1, 'path'
         20        SEND_VAL                                                 ~12
         21        DO_ICALL                                         $13     
         22        SEND_VAR_NO_REF                               0          $13
         23        DO_ICALL                                         $14     
         24        SEND_VAR                                                 $14
         25        DO_ICALL                                         $15     
         26        ASSIGN_DIM                                               !1, 'path'
         27        OP_DATA                                                  $15
   12    28    >   UNSET_DIM                                                !1, 'query'
   13    29        UNSET_DIM                                                !1, 'fragment'
   16    30    >   INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.41 ms | 1396 KiB | 25 Q