3v4l.org

run code in 300+ PHP versions simultaneously
<?php $homepage = "https://example.com/"; $html = '<img class="drt" src="100.png"><img src="../101.png"><img src="/102.png"><img src="103.png">'; $check_img = preg_match_all("/<img .*?(?=src)src=\"([^\"]+)\"/si", $html, $m); foreach ($m[1] as $img){ if (strpos($img, $homepage) == false) { $old_img = $img; $html = str_replace($old_img, $homepage.basename($old_img), $html); } } echo $html;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 28
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 28
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/LvL82
function name:  (null)
number of ops:  32
compiled vars:  !0 = $homepage, !1 = $html, !2 = $check_img, !3 = $m, !4 = $img, !5 = $old_img
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'https%3A%2F%2Fexample.com%2F'
    3     1        ASSIGN                                                   !1, '%3Cimg+class%3D%22drt%22+src%3D%22100.png%22%3E%3Cimg+src%3D%22..%2F101.png%22%3E%3Cimg+src%3D%22%2F102.png%22%3E%3Cimg+src%3D%22103.png%22%3E'
    5     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%3Cimg+.%2A%3F%28%3F%3Dsrc%29src%3D%22%28%5B%5E%22%5D%2B%29%22%2Fsi'
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !3
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !2, $8
    7     8        FETCH_DIM_R                                      ~10     !3, 1
          9      > FE_RESET_R                                       $11     ~10, ->29
         10    > > FE_FETCH_R                                               $11, !4, ->29
    8    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !4
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $12     
         15        BOOL_NOT                                         ~13     $12
         16      > JMPZ                                                     ~13, ->28
    9    17    >   ASSIGN                                                   !5, !4
   11    18        INIT_FCALL                                               'str_replace'
         19        SEND_VAR                                                 !5
         20        INIT_FCALL                                               'basename'
         21        SEND_VAR                                                 !5
         22        DO_ICALL                                         $15     
         23        CONCAT                                           ~16     !0, $15
         24        SEND_VAL                                                 ~16
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !1, $17
    7    28    > > JMP                                                      ->10
         29    >   FE_FREE                                                  $11
   14    30        ECHO                                                     !1
   15    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.46 ms | 1014 KiB | 17 Q