3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parse($urls) { // prepare the result $result = []; foreach($urls as $url){ // pass the whole url to parse_url $parts = parse_url($url); // then reference the parts from that result // and add the final version to the to-be-returned-result $result[] = $parts['scheme'] . '://' . $parts['host'] . '/bmw' . $parts['path']; } return $result; } print_r(parse([ 'https://example.com/newcar' ]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X9Q2H
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'parse'
   20     2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   21     6      > RETURN                                                   1

Function parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/X9Q2H
function name:  parse
number of ops:  21
compiled vars:  !0 = $urls, !1 = $result, !2 = $url, !3 = $parts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    7     2      > FE_RESET_R                                       $5      !0, ->18
          3    > > FE_FETCH_R                                               $5, !2, ->18
    9     4    >   INIT_FCALL                                               'parse_url'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !3, $6
   13     8        FETCH_DIM_R                                      ~9      !3, 'scheme'
          9        CONCAT                                           ~10     ~9, '%3A%2F%2F'
         10        FETCH_DIM_R                                      ~11     !3, 'host'
         11        CONCAT                                           ~12     ~10, ~11
         12        CONCAT                                           ~13     ~12, '%2Fbmw'
         13        FETCH_DIM_R                                      ~14     !3, 'path'
         14        CONCAT                                           ~15     ~13, ~14
         15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  ~15
    7    17      > JMP                                                      ->3
         18    >   FE_FREE                                                  $5
   16    19      > RETURN                                                   !1
   17    20*     > RETURN                                                   null

End of function parse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.76 ms | 1403 KiB | 18 Q