3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<h2><span id="History"></span><span class="mw-headline" id="History">History</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Adamantina&amp;veaction=edit&amp;section=1" class="mw-editsection-visualeditor" title="Editar secção: History">editar</a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Adamantina&amp;action=edit&amp;section=1" title="Editar secção: History">editar código-fonte</a><span class="mw-editsection-bracket">]</span></span></h2>'; $d = new DOMDocument; libxml_use_internal_errors(true); $d->loadHTML($html); $domxpath = new DOMXPath($d); $paragraph = $domxpath->query('//h2/*[contains(text(), "History")]'); var_dump($paragraph->length); if ($paragraph->length > 0) { echo "Results!"; } else { echo "Not contained"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/471Wt
function name:  (null)
number of ops:  29
compiled vars:  !0 = $html, !1 = $d, !2 = $domxpath, !3 = $paragraph
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Ch2%3E%3Cspan+id%3D%22History%22%3E%3C%2Fspan%3E%3Cspan+class%3D%22mw-headline%22+id%3D%22History%22%3EHistory%3C%2Fspan%3E%3Cspan+class%3D%22mw-editsection%22%3E%3Cspan+class%3D%22mw-editsection-bracket%22%3E%5B%3C%2Fspan%3E%3Ca+href%3D%22%2Fw%2Findex.php%3Ftitle%3DAdamantina%26amp%3Bveaction%3Dedit%26amp%3Bsection%3D1%22+class%3D%22mw-editsection-visualeditor%22+title%3D%22Editar+sec%C3%A7%C3%A3o%3A+History%22%3Eeditar%3C%2Fa%3E%3Cspan+class%3D%22mw-editsection-divider%22%3E+%7C+%3C%2Fspan%3E%3Ca+href%3D%22%2Fw%2Findex.php%3Ftitle%3DAdamantina%26amp%3Baction%3Dedit%26amp%3Bsection%3D1%22+title%3D%22Editar+sec%C3%A7%C3%A3o%3A+History%22%3Eeditar+c%C3%B3digo-fonte%3C%2Fa%3E%3Cspan+class%3D%22mw-editsection-bracket%22%3E%5D%3C%2Fspan%3E%3C%2Fspan%3E%3C%2Fh2%3E'
    4     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
    5     4        INIT_FCALL                                               'libxml_use_internal_errors'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                                 
    6     7        INIT_METHOD_CALL                                         !1, 'loadHTML'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
    7    10        NEW                                              $10     'DOMXPath'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $10
    8    14        INIT_METHOD_CALL                                         !2, 'query'
         15        SEND_VAL_EX                                              '%2F%2Fh2%2F%2A%5Bcontains%28text%28%29%2C+%22History%22%29%5D'
         16        DO_FCALL                                      0  $13     
         17        ASSIGN                                                   !3, $13
    9    18        INIT_FCALL                                               'var_dump'
         19        FETCH_OBJ_R                                      ~15     !3, 'length'
         20        SEND_VAL                                                 ~15
         21        DO_ICALL                                                 
   10    22        FETCH_OBJ_R                                      ~17     !3, 'length'
         23        IS_SMALLER                                               0, ~17
         24      > JMPZ                                                     ~18, ->27
   11    25    >   ECHO                                                     'Results%21'
         26      > JMP                                                      ->28
   14    27    >   ECHO                                                     'Not+contained'
   15    28    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.01 ms | 1401 KiB | 17 Q