3v4l.org

run code in 300+ PHP versions simultaneously
<?php $image = 'image/testing.jpg'; $url = 'http://testing.com/randomdir'; $image_parts = parse_url($image); $url_parts = parse_url($url); // check to see if the image has a path of its own if (dirname($image_parts['path']) == '.') { $image_path = dirname($url_parts['path']) . DS . $image_parts['path']; } else { $image_path = $image_parts['path']; } if (empty($image_parts['host'])) { $image_location = sprintf('%s://%s/%s/%s', $url_parts['scheme'], $url_parts['host'], dirname($url_parts['path']), $image_path); } else { $image_location = $image; } var_dump($image_location);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 45
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 45
Branch analysis from position: 30
Branch analysis from position: 45
filename:       /in/HEI2q
function name:  (null)
number of ops:  50
compiled vars:  !0 = $image, !1 = $url, !2 = $image_parts, !3 = $url_parts, !4 = $image_path, !5 = $image_location
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'image%2Ftesting.jpg'
    4     1        ASSIGN                                                   !1, 'http%3A%2F%2Ftesting.com%2Frandomdir'
    6     2        INIT_FCALL                                               'parse_url'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !2, $8
    7     6        INIT_FCALL                                               'parse_url'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !3, $10
   10    10        INIT_FCALL                                               'dirname'
         11        FETCH_DIM_R                                      ~12     !2, 'path'
         12        SEND_VAL                                                 ~12
         13        DO_ICALL                                         $13     
         14        IS_EQUAL                                                 $13, '.'
         15      > JMPZ                                                     ~14, ->26
   11    16    >   INIT_FCALL                                               'dirname'
         17        FETCH_DIM_R                                      ~15     !3, 'path'
         18        SEND_VAL                                                 ~15
         19        DO_ICALL                                         $16     
         20        FETCH_CONSTANT                                   ~17     'DS'
         21        CONCAT                                           ~18     $16, ~17
         22        FETCH_DIM_R                                      ~19     !2, 'path'
         23        CONCAT                                           ~20     ~18, ~19
         24        ASSIGN                                                   !4, ~20
         25      > JMP                                                      ->28
   13    26    >   FETCH_DIM_R                                      ~22     !2, 'path'
         27        ASSIGN                                                   !4, ~22
   16    28    >   ISSET_ISEMPTY_DIM_OBJ                         1          !2, 'host'
         29      > JMPZ                                                     ~24, ->45
   17    30    >   INIT_FCALL                                               'sprintf'
         31        SEND_VAL                                                 '%25s%3A%2F%2F%25s%2F%25s%2F%25s'
         32        FETCH_DIM_R                                      ~25     !3, 'scheme'
         33        SEND_VAL                                                 ~25
         34        FETCH_DIM_R                                      ~26     !3, 'host'
         35        SEND_VAL                                                 ~26
         36        INIT_FCALL                                               'dirname'
         37        FETCH_DIM_R                                      ~27     !3, 'path'
         38        SEND_VAL                                                 ~27
         39        DO_ICALL                                         $28     
         40        SEND_VAR                                                 $28
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                         $29     
         43        ASSIGN                                                   !5, $29
         44      > JMP                                                      ->46
   19    45    >   ASSIGN                                                   !5, !0
   22    46    >   INIT_FCALL                                               'var_dump'
         47        SEND_VAR                                                 !5
         48        DO_ICALL                                                 
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.24 ms | 1400 KiB | 21 Q