3v4l.org

run code in 300+ PHP versions simultaneously
<?php $baseuri = $uri = parse_url('http://test.com/start/par/1/2/3', PHP_URL_PATH); $base = dirname('/start/index.php'); if (0 === strpos($uri, $base)) { $baseuri = substr($uri, 0, strlen($base)); } var_dump($baseuri);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/VT3qL
function name:  (null)
number of ops:  27
compiled vars:  !0 = $baseuri, !1 = $uri, !2 = $base
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'parse_url'
          1        SEND_VAL                                                 'http%3A%2F%2Ftest.com%2Fstart%2Fpar%2F1%2F2%2F3'
          2        SEND_VAL                                                 5
          3        DO_ICALL                                         $3      
          4        ASSIGN                                           ~4      !1, $3
          5        ASSIGN                                                   !0, ~4
    4     6        INIT_FCALL                                               'dirname'
          7        SEND_VAL                                                 '%2Fstart%2Findex.php'
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !2, $6
    6    10        INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !1
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14        IS_IDENTICAL                                             $8, 0
         15      > JMPZ                                                     ~9, ->23
    8    16    >   INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !1
         18        SEND_VAL                                                 0
         19        STRLEN                                           ~10     !2
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                         $11     
         22        ASSIGN                                                   !0, $11
   11    23    >   INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.88 ms | 1395 KiB | 23 Q