3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOT <html><body><h2>Hello</h2> <h2>World</h2><h2><strong>!</strong></h2></body></html> EOT; $dom = new DOMDocument(); $dom->loadHTML($html); foreach($dom->getElementsByTagName('h2') as $h2) { if(!count($h2->getElementsByTagName('*'))){ var_dump($h2->textContent); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/dI1e4
function name:  (null)
number of ops:  25
compiled vars:  !0 = $html, !1 = $dom, !2 = $h2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Chtml%3E%3Cbody%3E%3Ch2%3EHello%3C%2Fh2%3E+%3Ch2%3EWorld%3C%2Fh2%3E%3Ch2%3E%3Cstrong%3E%21%3C%2Fstrong%3E%3C%2Fh2%3E%3C%2Fbody%3E%3C%2Fhtml%3E'
    7     1        NEW                                              $4      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
    8     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    9     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'h2'
          9        DO_FCALL                                      0  $8      
         10      > FE_RESET_R                                       $9      $8, ->23
         11    > > FE_FETCH_R                                               $9, !2, ->23
   10    12    >   INIT_METHOD_CALL                                         !2, 'getElementsByTagName'
         13        SEND_VAL_EX                                              '%2A'
         14        DO_FCALL                                      0  $10     
         15        COUNT                                            ~11     $10
         16        BOOL_NOT                                         ~12     ~11
         17      > JMPZ                                                     ~12, ->22
   11    18    >   INIT_FCALL                                               'var_dump'
         19        FETCH_OBJ_R                                      ~13     !2, 'textContent'
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                                 
    9    22    > > JMP                                                      ->11
         23    >   FE_FREE                                                  $9
   13    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.88 ms | 1011 KiB | 14 Q