3v4l.org

run code in 300+ PHP versions simultaneously
<?php $request_uri = parse_url( '/test/path/to/something', PHP_URL_PATH ); $uri_parts = explode( '/', trim( $request_uri, '/' ) ); $levels = array(); for ( $i = $uri_parts - 2; $i > 0; --$i ) { $levels[] = '/' . join( '/', array_slice( $uri_parts, 0, $i ) ) . '/'; } var_dump( $levels );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
Branch analysis from position: 18
filename:       /in/PC5En
function name:  (null)
number of ops:  38
compiled vars:  !0 = $request_uri, !1 = $uri_parts, !2 = $levels, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'parse_url'
          1        SEND_VAL                                                 '%2Ftest%2Fpath%2Fto%2Fsomething'
          2        SEND_VAL                                                 5
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    4     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '%2F'
          7        INIT_FCALL                                               'trim'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '%2F'
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                         $7      
         13        ASSIGN                                                   !1, $7
    5    14        ASSIGN                                                   !2, <array>
    7    15        SUB                                              ~10     !1, 2
         16        ASSIGN                                                   !3, ~10
         17      > JMP                                                      ->32
    9    18    >   INIT_FCALL                                               'join'
         19        SEND_VAL                                                 '%2F'
         20        INIT_FCALL                                               'array_slice'
         21        SEND_VAR                                                 !1
         22        SEND_VAL                                                 0
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $13     
         25        SEND_VAR                                                 $13
         26        DO_ICALL                                         $14     
         27        CONCAT                                           ~15     '%2F', $14
         28        CONCAT                                           ~16     ~15, '%2F'
         29        ASSIGN_DIM                                               !2
         30        OP_DATA                                                  ~16
    7    31        PRE_DEC                                                  !3
         32    >   IS_SMALLER                                               0, !3
         33      > JMPNZ                                                    ~18, ->18
   12    34    >   INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.5 ms | 1396 KiB | 25 Q