3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = '<img src="source.jpg">'; $string = '<div id="pf1" class="pf w0 h0" data-page-no="1"> <div class="pc pc1 w0 h0"> <img class="bi x0 y0 w0 h0" alt="" src="../images/cover.jpg"/> </div>'; $find = '/<img(.*?)\/>/'; echo preg_replace($find, $source, $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6CYQU
function name:  (null)
number of ops:  10
compiled vars:  !0 = $source, !1 = $string, !2 = $find
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cimg+src%3D%22source.jpg%22%3E'
    4     1        ASSIGN                                                   !1, '%3Cdiv+id%3D%22pf1%22+class%3D%22pf+w0+h0%22+data-page-no%3D%221%22%3E%0A%3Cdiv+class%3D%22pc+pc1+w0+h0%22%3E%0A++%3Cimg+class%3D%22bi+x0+y0+w0+h0%22+alt%3D%22%22+src%3D%22..%2Fimages%2Fcover.jpg%22%2F%3E%0A%3C%2Fdiv%3E'
    9     2        ASSIGN                                                   !2, '%2F%3Cimg%28.%2A%3F%29%5C%2F%3E%2F'
   10     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $6      
          8        ECHO                                                     $6
          9      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.36 ms | 1000 KiB | 14 Q