3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html=<<<HTML <img src="/relative/url/img.jpg" /> <form action="/"> <a href='/relative/url/'>Note the Single Quote</a> <img src="//site.com/protocol-relative-img.jpg" /> HTML; $base='https://example.com'; echo preg_replace('~(?:src|action|href)=[\'"]\K/(?!/)[^\'"]*~',"$base$0",$html);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6vtMu
function name:  (null)
number of ops:  8
compiled vars:  !0 = $html, !1 = $base
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Cimg+src%3D%22%2Frelative%2Furl%2Fimg.jpg%22+%2F%3E%0A%3Cform+action%3D%22%2F%22%3E%0A%3Ca+href%3D%27%2Frelative%2Furl%2F%27%3ENote+the+Single+Quote%3C%2Fa%3E%0A%3Cimg+src%3D%22%2F%2Fsite.com%2Fprotocol-relative-img.jpg%22+%2F%3E'
    9     1        ASSIGN                                                       !1, 'https%3A%2F%2Fexample.com'
   11     2        NOP                                                          
          3        FAST_CONCAT                                          ~4      !1, '%240'
          4        FRAMELESS_ICALL_3                preg_replace        ~5      '%7E%28%3F%3Asrc%7Caction%7Chref%29%3D%5B%27%22%5D%5CK%2F%28%3F%21%2F%29%5B%5E%27%22%5D%2A%7E', ~4
          5        OP_DATA                                                      !0
          6        ECHO                                                         ~5
          7      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.39 ms | 2647 KiB | 13 Q