3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sadrzaj = '<p>asdasdasds</p><p><a href="http://www.example.com/wp-content/uploads/2018/11/image.jpg" itemprop="url" title="some title"><img alt="some alt title" class="alignnone not-size-full wp-image-243618" src="http://www.example.com/wp-content/uploads/2018/11/image.jpg" width="940" height="529"></a></p>asdasdasd<p>asdasd</p><h3>asdada</h3><p><a href="http://www.example.com/wp-content/uploads/2018/11/image_02.jpg" itemprop="url" title="some title 02"><img alt="some alt title 02" class="alignnone size-full wp-image-243653" src="http://www.example.com/wp-content/uploads/2018/11/image_02.jpg" width="940" height="529"></a></p><h3>asdasd</h3>'; function to_je_to($content){ preg_match_all('/<img[^>]+>/', $content, $images); print_r($images); if(!is_null($images)){ foreach($images[0] as $index => $value){ if(preg_match('/class="[^"]* size-full[ "]/', $value)){ $new_img = str_replace('<img', '<img data-example', $value); $content = preg_replace('/' . preg_quote($value, '/') . '/', $new_img, $content); } } } return $content; // return no difference } echo to_je_to($sadrzaj);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hJT3t
function name:  (null)
number of ops:  6
compiled vars:  !0 = $sadrzaj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3Easdasdasds%3C%2Fp%3E%3Cp%3E%3Ca+href%3D%22http%3A%2F%2Fwww.example.com%2Fwp-content%2Fuploads%2F2018%2F11%2Fimage.jpg%22+itemprop%3D%22url%22+title%3D%22some+title%22%3E%3Cimg+alt%3D%22some+alt+title%22+class%3D%22alignnone+not-size-full+wp-image-243618%22+src%3D%22http%3A%2F%2Fwww.example.com%2Fwp-content%2Fuploads%2F2018%2F11%2Fimage.jpg%22+width%3D%22940%22+height%3D%22529%22%3E%3C%2Fa%3E%3C%2Fp%3Easdasdasd%3Cp%3Easdasd%3C%2Fp%3E%3Ch3%3Easdada%3C%2Fh3%3E%3Cp%3E%3Ca+href%3D%22http%3A%2F%2Fwww.example.com%2Fwp-content%2Fuploads%2F2018%2F11%2Fimage_02.jpg%22+itemprop%3D%22url%22+title%3D%22some+title+02%22%3E%3Cimg+alt%3D%22some+alt+title+02%22+class%3D%22alignnone+size-full+wp-image-243653%22+src%3D%22http%3A%2F%2Fwww.example.com%2Fwp-content%2Fuploads%2F2018%2F11%2Fimage_02.jpg%22+width%3D%22940%22+height%3D%22529%22%3E%3C%2Fa%3E%3C%2Fp%3E%3Ch3%3Easdasd%3C%2Fh3%3E'
   18     1        INIT_FCALL                                               'to_je_to'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function to_je_to:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 41
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 40
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 40
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 39
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 39
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 41
filename:       /in/hJT3t
function name:  to_je_to
number of ops:  43
compiled vars:  !0 = $content, !1 = $images, !2 = $value, !3 = $index, !4 = $new_img
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%3Cimg%5B%5E%3E%5D%2B%3E%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    6     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
    8     9        TYPE_CHECK                                    2  ~7      !1
         10        BOOL_NOT                                         ~8      ~7
         11      > JMPZ                                                     ~8, ->41
    9    12    >   FETCH_DIM_R                                      ~9      !1, 0
         13      > FE_RESET_R                                       $10     ~9, ->40
         14    > > FE_FETCH_R                                       ~11     $10, !2, ->40
         15    >   ASSIGN                                                   !3, ~11
   10    16        INIT_FCALL                                               'preg_match'
         17        SEND_VAL                                                 '%2Fclass%3D%22%5B%5E%22%5D%2A+size-full%5B+%22%5D%2F'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                         $13     
         20      > JMPZ                                                     $13, ->39
   11    21    >   INIT_FCALL                                               'str_replace'
         22        SEND_VAL                                                 '%3Cimg'
         23        SEND_VAL                                                 '%3Cimg+data-example'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $14     
         26        ASSIGN                                                   !4, $14
   12    27        INIT_FCALL                                               'preg_replace'
         28        INIT_FCALL                                               'preg_quote'
         29        SEND_VAR                                                 !2
         30        SEND_VAL                                                 '%2F'
         31        DO_ICALL                                         $16     
         32        CONCAT                                           ~17     '%2F', $16
         33        CONCAT                                           ~18     ~17, '%2F'
         34        SEND_VAL                                                 ~18
         35        SEND_VAR                                                 !4
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $19     
         38        ASSIGN                                                   !0, $19
    9    39    > > JMP                                                      ->14
         40    >   FE_FREE                                                  $10
   16    41    > > RETURN                                                   !0
   17    42*     > RETURN                                                   null

End of function to_je_to

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.76 ms | 1023 KiB | 20 Q