3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'qwe <img src="http://img7.arrivo.ru/inlabu/47/0/sfsjho.jpg" /> sdfj <img src="http://img7.arrivo.ru/inlabu/47/0/sfsjho.jpg" style="width: 200px;" /> gbfkljho <img src=\'http://img7.arrivo.ru/inlabu/47/0/sfsjho.jpg\' /> sdfj <img src=\'http://img7.arrivo.ru/inlabu/47/0/sfsjho.jpg\' style=\'width: 200px;\' /> gbfkljho <img src=http://img7.arrivo.ru/inlabu/47/0/sfsjho.jpg /> sdfj <img style="width: 200px;" src=http://img7.arrivo.ru/inlabu/47/0/sfsjho.jpg /> gbfkljho'; $oldImage = [ 'path' => 'inlabu', 'id' => 47, 'url' => 'sfsjho.jpg', ]; $text = preg_replace('|<img(?!.*width)(.+)http://img7\.arrivo\.ru/'.$oldImage['path'].'/'.$oldImage['id'].'/\d/'.str_replace('.', '\.', urlencode($oldImage['url'])).'(?!.*width)(.*)>|U', '<img\\1\\2http://google.com\\3\\4>', $text); var_dump($text);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qHf0C
function name:  (null)
number of ops:  29
compiled vars:  !0 = $text, !1 = $oldImage
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'qwe+%3Cimg+src%3D%22http%3A%2F%2Fimg7.arrivo.ru%2Finlabu%2F47%2F0%2Fsfsjho.jpg%22+%2F%3E+sdfj+%3Cimg+src%3D%22http%3A%2F%2Fimg7.arrivo.ru%2Finlabu%2F47%2F0%2Fsfsjho.jpg%22+style%3D%22width%3A+200px%3B%22+%2F%3E+gbfkljho+%3Cimg+src%3D%27http%3A%2F%2Fimg7.arrivo.ru%2Finlabu%2F47%2F0%2Fsfsjho.jpg%27+%2F%3E+sdfj+%3Cimg+src%3D%27http%3A%2F%2Fimg7.arrivo.ru%2Finlabu%2F47%2F0%2Fsfsjho.jpg%27+style%3D%27width%3A+200px%3B%27+%2F%3E+gbfkljho+%3Cimg+src%3Dhttp%3A%2F%2Fimg7.arrivo.ru%2Finlabu%2F47%2F0%2Fsfsjho.jpg+%2F%3E+sdfj+%3Cimg+style%3D%22width%3A+200px%3B%22+src%3Dhttp%3A%2F%2Fimg7.arrivo.ru%2Finlabu%2F47%2F0%2Fsfsjho.jpg+%2F%3E+gbfkljho'
    5     1        ASSIGN                                                   !1, <array>
   11     2        INIT_FCALL                                               'preg_replace'
          3        FETCH_DIM_R                                      ~4      !1, 'path'
          4        CONCAT                                           ~5      '%7C%3Cimg%28%3F%21.%2Awidth%29%28.%2B%29http%3A%2F%2Fimg7%5C.arrivo%5C.ru%2F', ~4
          5        CONCAT                                           ~6      ~5, '%2F'
          6        FETCH_DIM_R                                      ~7      !1, 'id'
          7        CONCAT                                           ~8      ~6, ~7
          8        CONCAT                                           ~9      ~8, '%2F%5Cd%2F'
          9        INIT_FCALL                                               'str_replace'
         10        SEND_VAL                                                 '.'
         11        SEND_VAL                                                 '%5C.'
         12        INIT_FCALL                                               'urlencode'
         13        FETCH_DIM_R                                      ~10     !1, 'url'
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                         $11     
         16        SEND_VAR                                                 $11
         17        DO_ICALL                                         $12     
         18        CONCAT                                           ~13     ~9, $12
         19        CONCAT                                           ~14     ~13, '%28%3F%21.%2Awidth%29%28.%2A%29%3E%7CU'
         20        SEND_VAL                                                 ~14
         21        SEND_VAL                                                 '%3Cimg%5C1%5C2http%3A%2F%2Fgoogle.com%5C3%5C4%3E'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $15     
         24        ASSIGN                                                   !0, $15
   13    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.86 ms | 1396 KiB | 21 Q