3v4l.org

run code in 300+ PHP versions simultaneously
<?php $inbox_message = '<p> Keep This</p><img src="http://example.com/someimage1.jpeg"><img src="http://example.com/someimage2.jpeg"><img src="http://example.com/someimage3.jpeg"><img src="http://example.com/someimage4.jpeg"><h1>Fake element</h1><img style="OVERFLOW: hidden; WIDTH: 0px; MAX-HEIGHT: 0px" alt="" src="http://test.mydomain.com/project433q325/track/Images/signature.gif?id=446&amp;etc=1586624376">'; $doc = new DOMDocument(); $doc->loadHTML($inbox_message); $imgs = $doc->getElementsByTagName('img'); for($i = $imgs->length; --$i >= 0;){ $node = $imgs->item($i); if (strpos($node->getAttribute('src'), 'http://test.mydomain.com/project433q325/track/Images/signature.gif?') !== false) { $node->parentNode->removeChild($node); } } echo $doc->savehtml();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 14
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 14
Branch analysis from position: 34
Branch analysis from position: 14
Branch analysis from position: 31
filename:       /in/qinLR
function name:  (null)
number of ops:  38
compiled vars:  !0 = $inbox_message, !1 = $doc, !2 = $imgs, !3 = $i, !4 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cp%3E+Keep+This%3C%2Fp%3E%3Cimg+src%3D%22http%3A%2F%2Fexample.com%2Fsomeimage1.jpeg%22%3E%3Cimg+src%3D%22http%3A%2F%2Fexample.com%2Fsomeimage2.jpeg%22%3E%3Cimg+src%3D%22http%3A%2F%2Fexample.com%2Fsomeimage3.jpeg%22%3E%3Cimg+src%3D%22http%3A%2F%2Fexample.com%2Fsomeimage4.jpeg%22%3E%3Ch1%3EFake+element%3C%2Fh1%3E%3Cimg+style%3D%22OVERFLOW%3A+hidden%3B+WIDTH%3A+0px%3B+MAX-HEIGHT%3A+0px%22+alt%3D%22%22+src%3D%22http%3A%2F%2Ftest.mydomain.com%2Fproject433q325%2Ftrack%2FImages%2Fsignature.gif%3Fid%3D446%26amp%3Betc%3D1586624376%22%3E'
    3     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
    4     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    5     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'img'
          9        DO_FCALL                                      0  $10     
         10        ASSIGN                                                   !2, $10
    6    11        FETCH_OBJ_R                                      ~12     !2, 'length'
         12        ASSIGN                                                   !3, ~12
         13      > JMP                                                      ->31
    7    14    >   INIT_METHOD_CALL                                         !2, 'item'
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0  $14     
         17        ASSIGN                                                   !4, $14
    8    18        INIT_FCALL                                               'strpos'
         19        INIT_METHOD_CALL                                         !4, 'getAttribute'
         20        SEND_VAL_EX                                              'src'
         21        DO_FCALL                                      0  $16     
         22        SEND_VAR                                                 $16
         23        SEND_VAL                                                 'http%3A%2F%2Ftest.mydomain.com%2Fproject433q325%2Ftrack%2FImages%2Fsignature.gif%3F'
         24        DO_ICALL                                         $17     
         25        TYPE_CHECK                                  1018          $17
         26      > JMPZ                                                     ~18, ->31
    9    27    >   FETCH_OBJ_R                                      ~19     !4, 'parentNode'
         28        INIT_METHOD_CALL                                         ~19, 'removeChild'
         29        SEND_VAR_EX                                              !4
         30        DO_FCALL                                      0          
    6    31    >   PRE_DEC                                          ~21     !3
         32        IS_SMALLER_OR_EQUAL                                      0, ~21
         33      > JMPNZ                                                    ~22, ->14
   12    34    >   INIT_METHOD_CALL                                         !1, 'savehtml'
         35        DO_FCALL                                      0  $23     
         36        ECHO                                                     $23
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.74 ms | 1007 KiB | 14 Q