3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dom = new DOMDocument(); $dom->loadHtml(' <form> <label>a</label> <input /> <label>b</label> <input /> <label>c</label> <input /> </form> ', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); foreach ($xpath->query("//label") as $label) $label->parentNode->removeChild($label); echo $dom->saveHTML(); // $dom = new DOMDocument(); $dom->loadHtml(' <form> <label>a</label> <input /> <label>b</label> <input /> <label>c</label> <input /> </form> ', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); foreach (iterator_to_array($dom->getElementsByTagName('label')) as $label) $label->parentNode->removeChild($label); echo $dom->saveHTML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
2 jumps found. (Code = 78) Position 1 = 40, Position 2 = 45
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 21
filename:       /in/WJpqk
function name:  (null)
number of ops:  50
compiled vars:  !0 = $dom, !1 = $xpath, !2 = $label
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   NEW                                                  $3      'DOMDocument'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
    4     3        INIT_METHOD_CALL                                             !0, 'loadHtml'
          4        SEND_VAL_EX                                                  '%0A%3Cform%3E%0A++++%3Clabel%3Ea%3C%2Flabel%3E%0A++++%3Cinput+%2F%3E%0A++++%3Clabel%3Eb%3C%2Flabel%3E%0A++++%3Cinput+%2F%3E%0A++++%3Clabel%3Ec%3C%2Flabel%3E%0A++++%3Cinput+%2F%3E%0A%3C%2Fform%3E%0A'
   13     5        SEND_VAL_EX                                                  8196
    4     6        DO_FCALL                                          0          
   15     7        NEW                                                  $7      'DOMXPath'
          8        SEND_VAR_EX                                                  !0
          9        DO_FCALL                                          0          
         10        ASSIGN                                                       !1, $7
   17    11        INIT_METHOD_CALL                                             !1, 'query'
         12        SEND_VAL_EX                                                  '%2F%2Flabel'
         13        DO_FCALL                                          0  $10     
         14      > FE_RESET_R                                           $11     $10, ->21
         15    > > FE_FETCH_R                                                   $11, !2, ->21
         16    >   FETCH_OBJ_R                                          ~12     !2, 'parentNode'
         17        INIT_METHOD_CALL                                             ~12, 'removeChild'
         18        SEND_VAR_EX                                                  !2
         19        DO_FCALL                                          0          
         20      > JMP                                                          ->15
         21    >   FE_FREE                                                      $11
   19    22        INIT_METHOD_CALL                                             !0, 'saveHTML'
         23        DO_FCALL                                          0  $14     
         24        ECHO                                                         $14
   24    25        NEW                                                  $15     'DOMDocument'
         26        DO_FCALL                                          0          
         27        ASSIGN                                                       !0, $15
   26    28        INIT_METHOD_CALL                                             !0, 'loadHtml'
         29        SEND_VAL_EX                                                  '%0A%3Cform%3E%0A++++%3Clabel%3Ea%3C%2Flabel%3E%0A++++%3Cinput+%2F%3E%0A++++%3Clabel%3Eb%3C%2Flabel%3E%0A++++%3Cinput+%2F%3E%0A++++%3Clabel%3Ec%3C%2Flabel%3E%0A++++%3Cinput+%2F%3E%0A%3C%2Fform%3E%0A'
   35    30        SEND_VAL_EX                                                  8196
   26    31        DO_FCALL                                          0          
   37    32        INIT_FCALL                                                   'iterator_to_array'
         33        INIT_METHOD_CALL                                             !0, 'getElementsByTagName'
         34        SEND_VAL_EX                                                  'label'
         35        DO_FCALL                                          0  $19     
         36        SEND_VAR                                                     $19
         37        DO_ICALL                                             $20     
         38      > FE_RESET_R                                           $21     $20, ->45
         39    > > FE_FETCH_R                                                   $21, !2, ->45
         40    >   FETCH_OBJ_R                                          ~22     !2, 'parentNode'
         41        INIT_METHOD_CALL                                             ~22, 'removeChild'
         42        SEND_VAR_EX                                                  !2
         43        DO_FCALL                                          0          
         44      > JMP                                                          ->39
         45    >   FE_FREE                                                      $21
   39    46        INIT_METHOD_CALL                                             !0, 'saveHTML'
         47        DO_FCALL                                          0  $24     
         48        ECHO                                                         $24
         49      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.22 ms | 1879 KiB | 14 Q