3v4l.org

run code in 300+ PHP versions simultaneously
<?php function absolute_path($base, $relative) { list($stack, $parts) = [explode('/', $base), explode('/', $relative)]; array_pop($stack); for ($i = 0; $i < count($parts); $i++) { if ($parts[$i] == '') continue; elseif ($parts[$i] == '..') array_pop($stack); else array_push($stack, $parts[$i]); } return join('/', $stack); } echo absolute_path( 'http://mhelper.ru/project/dev/works/ElenaBeauty/index.html', '../../../styles/owl.carousel.css' );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GfMbB
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'absolute_path'
   22     1        SEND_VAL                                                 'http%3A%2F%2Fmhelper.ru%2Fproject%2Fdev%2Fworks%2FElenaBeauty%2Findex.html'
   23     2        SEND_VAL                                                 '..%2F..%2F..%2Fstyles%2Fowl.carousel.css'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   24     5      > RETURN                                                   1

Function absolute_path:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 22
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 22
Branch analysis from position: 43
Branch analysis from position: 22
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 34
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 22
Branch analysis from position: 43
Branch analysis from position: 22
filename:       /in/GfMbB
function name:  absolute_path
number of ops:  49
compiled vars:  !0 = $base, !1 = $relative, !2 = $stack, !3 = $parts, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2F'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        INIT_ARRAY                                       ~6      $5
          7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2F'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $7      
         11        ADD_ARRAY_ELEMENT                                ~6      $7
         12        FETCH_LIST_R                                     $8      ~6, 0
         13        ASSIGN                                                   !2, $8
         14        FETCH_LIST_R                                     $10     ~6, 1
         15        ASSIGN                                                   !3, $10
         16        FREE                                                     ~6
    6    17        INIT_FCALL                                               'array_pop'
         18        SEND_REF                                                 !2
         19        DO_ICALL                                                 
    8    20        ASSIGN                                                   !4, 0
         21      > JMP                                                      ->40
   10    22    >   FETCH_DIM_R                                      ~14     !3, !4
         23        IS_EQUAL                                                 ~14, ''
         24      > JMPZ                                                     ~15, ->27
   11    25    > > JMP                                                      ->39
         26*       JMP                                                      ->39
   12    27    >   FETCH_DIM_R                                      ~16     !3, !4
         28        IS_EQUAL                                                 ~16, '..'
         29      > JMPZ                                                     ~17, ->34
   13    30    >   INIT_FCALL                                               'array_pop'
         31        SEND_REF                                                 !2
         32        DO_ICALL                                                 
         33      > JMP                                                      ->39
   15    34    >   INIT_FCALL                                               'array_push'
         35        SEND_REF                                                 !2
         36        FETCH_DIM_R                                      ~19     !3, !4
         37        SEND_VAL                                                 ~19
         38        DO_ICALL                                                 
    8    39    >   PRE_INC                                                  !4
         40    >   COUNT                                            ~22     !3
         41        IS_SMALLER                                               !4, ~22
         42      > JMPNZ                                                    ~23, ->22
   18    43    >   INIT_FCALL                                               'join'
         44        SEND_VAL                                                 '%2F'
         45        SEND_VAR                                                 !2
         46        DO_ICALL                                         $24     
         47      > RETURN                                                   $24
   19    48*     > RETURN                                                   null

End of function absolute_path

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.65 ms | 1407 KiB | 22 Q