3v4l.org

run code in 300+ PHP versions simultaneously
<?php $htmlString = '<html><head><script>wohoo</script></head><body><script>test</script></body></html>'; $dom = new DOMDocument; $dom->loadHTML($htmlString); $xPath = new DOMXPath($dom); $nodes = $xPath->query('//script'); foreach($nodes as $node) { $node->parentNode->removeChild($node); } echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/jFOcN
function name:  (null)
number of ops:  27
compiled vars:  !0 = $htmlString, !1 = $dom, !2 = $xPath, !3 = $nodes, !4 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Chtml%3E%3Chead%3E%3Cscript%3Ewohoo%3C%2Fscript%3E%3C%2Fhead%3E%3Cbody%3E%3Cscript%3Etest%3C%2Fscript%3E%3C%2Fbody%3E%3C%2Fhtml%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        NEW                                              $10     'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
    6    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fscript'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !3, $13
    7    15      > FE_RESET_R                                       $15     !3, ->22
         16    > > FE_FETCH_R                                               $15, !4, ->22
    8    17    >   FETCH_OBJ_R                                      ~16     !4, 'parentNode'
         18        INIT_METHOD_CALL                                         ~16, 'removeChild'
         19        SEND_VAR_EX                                              !4
         20        DO_FCALL                                      0          
    7    21      > JMP                                                      ->16
         22    >   FE_FREE                                                  $15
   10    23        INIT_METHOD_CALL                                         !1, 'saveHTML'
         24        DO_FCALL                                      0  $18     
         25        ECHO                                                     $18
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.45 ms | 1395 KiB | 13 Q