3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = "Hello <img src='https://example.com/image1.jpg'> , <img src='example.com/image2.jpg'> and now you :)"; $str = preg_replace('/<img[^>]*src=([\'"])(.*?)\1>/', "{#img='$2', alt=''}", $text); echo $str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Vnv9
function name:  (null)
number of ops:  9
compiled vars:  !0 = $text, !1 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Hello+%3Cimg+src%3D%27https%3A%2F%2Fexample.com%2Fimage1.jpg%27%3E+%2C+%3Cimg+src%3D%27example.com%2Fimage2.jpg%27%3E+and+now+you+%3A%29'
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%3Cimg%5B%5E%3E%5D%2Asrc%3D%28%5B%27%22%5D%29%28.%2A%3F%29%5C1%3E%2F'
          3        SEND_VAL                                                 '%7B%23img%3D%27%242%27%2C+alt%3D%27%27%7D'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !1, $3
    6     7        ECHO                                                     !1
    7     8      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.52 ms | 1008 KiB | 14 Q