3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <a name="file_type_definition"></a>file_type_definition ::= <font color=#a08000><strong>FILE<strong>other stuff</strong></strong></font> <font color=#a08000><strong>OF</strong></font> <a href="#type_mark">type_mark</a> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); foreach($xpath->query('//strong') as $strong) { $strong->parentNode->replaceChild(new DOMText(sprintf("'%s'", $strong->textContent)),$strong); } var_dump($dom->textContent);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 30
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/GpDgc
function name:  (null)
number of ops:  36
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath, !3 = $strong
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Ca+name%3D%22file_type_definition%22%3E%3C%2Fa%3Efile_type_definition+%3A%3A%3D%0A%09%3Cfont+color%3D%23a08000%3E%3Cstrong%3EFILE%3Cstrong%3Eother+stuff%3C%2Fstrong%3E%3C%2Fstrong%3E%3C%2Ffont%3E++%3Cfont+color%3D%23a08000%3E%3Cstrong%3EOF%3C%2Fstrong%3E%3C%2Ffont%3E+%3Ca+href%3D%22%23type_mark%22%3Etype_mark%3C%2Fa%3E'
    8     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
    9     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   10     7        NEW                                              $9      'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   12    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fstrong'
         13        DO_FCALL                                      0  $12     
         14      > FE_RESET_R                                       $13     $12, ->30
         15    > > FE_FETCH_R                                               $13, !3, ->30
   13    16    >   FETCH_OBJ_R                                      ~14     !3, 'parentNode'
         17        INIT_METHOD_CALL                                         ~14, 'replaceChild'
         18        NEW                                              $15     'DOMText'
         19        INIT_FCALL                                               'sprintf'
         20        SEND_VAL                                                 '%27%25s%27'
         21        FETCH_OBJ_R                                      ~16     !3, 'textContent'
         22        SEND_VAL                                                 ~16
         23        DO_ICALL                                         $17     
         24        SEND_VAR_NO_REF_EX                                       $17
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $15
         27        SEND_VAR_EX                                              !3
         28        DO_FCALL                                      0          
   12    29      > JMP                                                      ->15
         30    >   FE_FREE                                                  $13
   16    31        INIT_FCALL                                               'var_dump'
         32        FETCH_OBJ_R                                      ~20     !1, 'textContent'
         33        SEND_VAL                                                 ~20
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.31 ms | 1396 KiB | 17 Q