3v4l.org

run code in 500+ PHP versions simultaneously
<?php $link = "http://example.com/values?value1=12121&order=3&external=AFB3432*"; $find = ["value1=", "order=", "external="]; $repl = [10000, 3, "AAAAA"]; foreach($find as $key => $f){ $pos1 = strpos($link, $f); $pos2 = strpos(substr($link, $pos1), "&"); if($pos2 !== false){ $link = str_replace(substr($link, $pos1, $pos2), $f . $repl[$key], $link); }else{ $link = str_replace(substr($link, $pos1), $f . $repl[$key], $link); } } echo $link;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 28
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 28
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/1VZiq
function name:  (null)
number of ops:  31
compiled vars:  !0 = $link, !1 = $find, !2 = $repl, !3 = $f, !4 = $key, !5 = $pos1, !6 = $pos2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'http%3A%2F%2Fexample.com%2Fvalues%3Fvalue1%3D12121%26order%3D3%26external%3DAFB3432%2A'
    5     1        ASSIGN                                                       !1, <array>
    6     2        ASSIGN                                                       !2, <array>
    8     3      > FE_RESET_R                                           $10     !1, ->28
          4    > > FE_FETCH_R                                           ~11     $10, !3, ->28
          5    >   ASSIGN                                                       !4, ~11
    9     6        FRAMELESS_ICALL_2                strpos              ~13     !0, !3
          7        ASSIGN                                                       !5, ~13
   10     8        FRAMELESS_ICALL_2                substr              ~15     !0, !5
          9        FRAMELESS_ICALL_2                strpos              ~16     ~15, '%26'
         10        ASSIGN                                                       !6, ~16
   12    11        TYPE_CHECK                                      1018          !6
         12      > JMPZ                                                         ~18, ->21
   13    13    >   FRAMELESS_ICALL_3                substr              ~19     !0, !5
         14        OP_DATA                                                      !6
         15        FETCH_DIM_R                                          ~20     !2, !4
         16        CONCAT                                               ~21     !3, ~20
         17        FRAMELESS_ICALL_3                str_replace         ~22     ~19, ~21
         18        OP_DATA                                                      !0
         19        ASSIGN                                                       !0, ~22
   12    20      > JMP                                                          ->27
   15    21    >   FRAMELESS_ICALL_2                substr              ~24     !0, !5
         22        FETCH_DIM_R                                          ~25     !2, !4
         23        CONCAT                                               ~26     !3, ~25
         24        FRAMELESS_ICALL_3                str_replace         ~27     ~24, ~26
         25        OP_DATA                                                      !0
         26        ASSIGN                                                       !0, ~27
    8    27    > > JMP                                                          ->4
         28    >   FE_FREE                                                      $10
   19    29        ECHO                                                         !0
   20    30      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.8 ms | 2628 KiB | 13 Q