3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = <<<EOF <p>asdasd</p> <img src="img1.jpg" style="width: 180px;"> <p>asdasd</p> <img src="img2.jpg" style="width: 180px;"> <p>asdasd</p> <img src="img3.jpg" style="width: 180px;"> <p>asdasd</p> <img src="img4.jpg" style="width: 180px;"> EOF; $dom=new DOMDocument(); $dom->loadHTML($html); $imgs = $dom->getElementsByTagName("img"); foreach($imgs as $img){ $img->removeAttribute('style'); $img->setAttribute( 'src' , 'thumbnail.php?img=' . $img->getAttribute('src') ); } echo preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), '', $dom->saveHTML()));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 25
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 25
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/Gv4dp
function name:  (null)
number of ops:  34
compiled vars:  !0 = $html, !1 = $dom, !2 = $imgs, !3 = $img
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, '%0A%3Cp%3Easdasd%3C%2Fp%3E%0A%3Cimg+src%3D%22img1.jpg%22+style%3D%22width%3A+180px%3B%22%3E%0A%3Cp%3Easdasd%3C%2Fp%3E%0A%3Cimg+src%3D%22img2.jpg%22+style%3D%22width%3A+180px%3B%22%3E%0A%3Cp%3Easdasd%3C%2Fp%3E%0A%3Cimg+src%3D%22img3.jpg%22+style%3D%22width%3A+180px%3B%22%3E%0A%3Cp%3Easdasd%3C%2Fp%3E%0A%3Cimg+src%3D%22img4.jpg%22+style%3D%22width%3A+180px%3B%22%3E%0A'
   17     1        NEW                                                  $5      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $5
   18     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
   19     7        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                                  'img'
          9        DO_FCALL                                          0  $9      
         10        ASSIGN                                                       !2, $9
   20    11      > FE_RESET_R                                           $11     !2, ->25
         12    > > FE_FETCH_R                                                   $11, !3, ->25
   21    13    >   INIT_METHOD_CALL                                             !3, 'removeAttribute'
         14        SEND_VAL_EX                                                  'style'
         15        DO_FCALL                                          0          
   23    16        INIT_METHOD_CALL                                             !3, 'setAttribute'
         17        SEND_VAL_EX                                                  'src'
         18        INIT_METHOD_CALL                                             !3, 'getAttribute'
         19        SEND_VAL_EX                                                  'src'
         20        DO_FCALL                                          0  $13     
         21        CONCAT                                               ~14     'thumbnail.php%3Fimg%3D', $13
         22        SEND_VAL_EX                                                  ~14
         23        DO_FCALL                                          0          
   20    24      > JMP                                                          ->12
         25    >   FE_FREE                                                      $11
   26    26        INIT_METHOD_CALL                                             !1, 'saveHTML'
         27        DO_FCALL                                          0  $16     
         28        FRAMELESS_ICALL_3                str_replace         ~17     <array>, ''
         29        OP_DATA                                                      $16
         30        FRAMELESS_ICALL_3                preg_replace        ~18     '%2F%5E%3C%21DOCTYPE.%2B%3F%3E%2F', ''
         31        OP_DATA                                                      ~17
         32        ECHO                                                         ~18
         33      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.16 ms | 2860 KiB | 13 Q