3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <p>Some random text <iframe src="http://some-random-link.com" width="425" height="350" frameborder="0"></iframe> <iframe src="https://cant-touch-this.com" width="425" height="350" frameborder="0"></iframe> </p> HTML; $dom = new DOMDocument; $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); foreach ($xpath->query("//iframe[starts-with(@src, 'http') and not(starts-with(@src, 'https'))]/@src") as $src) { $src->nodeValue = substr_replace($src->nodeValue, 's', 4, 0); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 27
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 27
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/seaMg
function name:  (null)
number of ops:  32
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath, !3 = $src
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3ESome+random+text+%3Ciframe+src%3D%22http%3A%2F%2Fsome-random-link.com%22+width%3D%22425%22+height%3D%22350%22+frameborder%3D%220%22%3E%3C%2Fiframe%3E%0A%3Ciframe+src%3D%22https%3A%2F%2Fcant-touch-this.com%22+width%3D%22425%22+height%3D%22350%22+frameborder%3D%220%22%3E%3C%2Fiframe%3E%0A%3C%2Fp%3E'
    9     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   10     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAL_EX                                              8196
          7        DO_FCALL                                      0          
   11     8        NEW                                              $9      'DOMXPath'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $9
   12    12        INIT_METHOD_CALL                                         !2, 'query'
         13        SEND_VAL_EX                                              '%2F%2Fiframe%5Bstarts-with%28%40src%2C+%27http%27%29+and+not%28starts-with%28%40src%2C+%27https%27%29%29%5D%2F%40src'
         14        DO_FCALL                                      0  $12     
         15      > FE_RESET_R                                       $13     $12, ->27
         16    > > FE_FETCH_R                                               $13, !3, ->27
   13    17    >   INIT_FCALL                                               'substr_replace'
         18        FETCH_OBJ_R                                      ~15     !3, 'nodeValue'
         19        SEND_VAL                                                 ~15
         20        SEND_VAL                                                 's'
         21        SEND_VAL                                                 4
         22        SEND_VAL                                                 0
         23        DO_ICALL                                         $16     
         24        ASSIGN_OBJ                                               !3, 'nodeValue'
         25        OP_DATA                                                  $16
   12    26      > JMP                                                      ->16
         27    >   FE_FREE                                                  $13
   15    28        INIT_METHOD_CALL                                         !1, 'saveHTML'
         29        DO_FCALL                                      0  $17     
         30        ECHO                                                     $17
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.37 ms | 1003 KiB | 14 Q