3v4l.org

run code in 500+ 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 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 14
Branch analysis from position: 31
Branch analysis from position: 14
Branch analysis from position: 28
filename:       /in/qinLR
function name:  (null)
number of ops:  35
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                                                          ->28
    7    14    >   INIT_METHOD_CALL                                             !2, 'item'
         15        SEND_VAR_EX                                                  !3
         16        DO_FCALL                                          0  $14     
         17        ASSIGN                                                       !4, $14
    8    18        INIT_METHOD_CALL                                             !4, 'getAttribute'
         19        SEND_VAL_EX                                                  'src'
         20        DO_FCALL                                          0  $16     
         21        FRAMELESS_ICALL_2                strpos              ~17     $16, 'http%3A%2F%2Ftest.mydomain.com%2Fproject433q325%2Ftrack%2FImages%2Fsignature.gif%3F'
         22        TYPE_CHECK                                      1018          ~17
         23      > JMPZ                                                         ~18, ->28
    9    24    >   FETCH_OBJ_R                                          ~19     !4, 'parentNode'
         25        INIT_METHOD_CALL                                             ~19, 'removeChild'
         26        SEND_VAR_EX                                                  !4
         27        DO_FCALL                                          0          
    6    28    >   PRE_DEC                                              ~21     !3
         29        IS_SMALLER_OR_EQUAL                                          0, ~21
         30      > JMPNZ                                                        ~22, ->14
   12    31    >   INIT_METHOD_CALL                                             !1, 'savehtml'
         32        DO_FCALL                                          0  $23     
         33        ECHO                                                         $23
         34      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.16 ms | 2207 KiB | 13 Q