3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = <<<EOF <table class="track_list track_table" id="track_table"> <tbody> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">1.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/i-feel">I Feel</a> 04:18</div> </td> <td> <div class="info_link" style="visibility:visible">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:visible">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">2.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/wait">Wait</a> 06:03</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">3.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/superwoman">Superwoman</a> 03:46</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">4.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/in-the-night">In The Night</a> 05:41</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">5.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/what-to-do">What To Do</a> 03:52</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">6.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/its-been-a-while">It&#39;s Been A While</a> 05:49</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">7.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/move-on">Move On</a> 04:28</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">8.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/loverboy">Loverboy</a> 08:00</div> </td> <td> <div class="info_link" style="visibility:hidden">&nbsp;</div> </td> <td> <div class="dl_link" style="visibility:hidden">&nbsp;</div> </td> </tr> <tr> <td> <div class="play_status">&nbsp;</div> </td> <td> <div class="secondaryText track_number">9.</div> </td> <td> <div class="title"><a href="https://zars.bandcamp.com/track/parallel-world">Parallel World</a> 07:38</div> </td> <td>&nbsp;</td> <td>&nbsp;</td> </tr> </tbody> </table> EOF; $data = str_replace(["\r", "\n", "\t"], "", $data); $doc = new DOMDocument(); $doc->loadHTML('<div>' . $data . '</div>', LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new \DOMXpath($doc); // Remove all empty nodes $emptyNodes = $xpath->query("//text()[translate(normalize-space(.), '\"\xC2\xA0\', '') = '']"); foreach ($emptyNodes as $i => $node) { $node->parentNode->parentNode->removeChild($node->parentNode); } $list = $xpath->query(".//text()[translate(normalize-space(.), '\"\xC2\xA0\', '') != '']"); print_r("List size: $list->length \r\n"); function flattenDOMNodes(\DOMDocument &$doc, \DOMNodeLIst $list) { foreach ($list as $i => $node) { print_r("$i\r\n"); $parent = $node->parentNode; // Do not manipulate nodes directly under the root node to separate between tracks. if ($parent->parentNode !== $node->ownerDocument->documentElement) { if ($parent->previousSibling instanceof DOMText) { print_r("Also appending happens!\r\n"); $parent->previousSibling->appendData($node->nodeValue); $parent->parentNode->removeChild($parent); } elseif ($parent->nextSibling instanceof DOMText) { print_r("Also inserting happens!\r\n"); $parent->nextSibling->insertData(0, " $node->nodeValue "); $parent->parentNode->removeChild($parent); } else { $newNode = $doc->createTextNode($node->nodeValue); // Go up one level while ($parent->parentNode->childNodes->length === 1) { print_r("Up, up, up!\r\n"); $parent = $parent->parentNode; } print_r("This happens\r\n"); $parent->replaceChild($newNode, $parent->childNodes->item(0)); } } $xpath = new \DOMXpath($doc); $list = $xpath->query(".//text()[translate(normalize-space(.), '\"\xC2\xA0\', '') != '']"); } return $list; } var_dump(flattenDOMNodes($doc, $list)); var_dump($doc->saveHTML()); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/bajs1
function name:  (null)
number of ops:  60
compiled vars:  !0 = $data, !1 = $doc, !2 = $xpath, !3 = $emptyNodes, !4 = $node, !5 = $i, !6 = $list
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Ctable+class%3D%22track_list+track_table%22+id%3D%22track_table%22%3E%0A++++%3Ctbody%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E1.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fi-feel%22%3EI+Feel%3C%2Fa%3E+04%3A18%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Avisible%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Avisible%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E2.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fwait%22%3EWait%3C%2Fa%3E+06%3A03%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E3.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fsuperwoman%22%3ESuperwoman%3C%2Fa%3E+03%3A46%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E4.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fin-the-night%22%3EIn+The+Night%3C%2Fa%3E+05%3A41%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E5.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fwhat-to-do%22%3EWhat+To+Do%3C%2Fa%3E+03%3A52%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E6.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fits-been-a-while%22%3EIt%26%2339%3Bs+Been+A+While%3C%2Fa%3E+05%3A49%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E7.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fmove-on%22%3EMove+On%3C%2Fa%3E+04%3A28%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E8.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Floverboy%22%3ELoverboy%3C%2Fa%3E+08%3A00%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22info_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22dl_link%22+style%3D%22visibility%3Ahidden%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22play_status%22%3E%26nbsp%3B%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22secondaryText+track_number%22%3E9.%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%0A++++++++++++%3Cdiv+class%3D%22title%22%3E%3Ca+href%3D%22https%3A%2F%2Fzars.bandcamp.com%2Ftrack%2Fparallel-world%22%3EParallel+World%3C%2Fa%3E+07%3A38%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%26nbsp%3B%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%26nbsp%3B%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++%3C%2Ftbody%3E%0A%3C%2Ftable%3E'
  159     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !0, $8
  161     7        NEW                                              $10     'DOMDocument'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $10
  162    10        INIT_METHOD_CALL                                         !1, 'loadHTML'
         11        CONCAT                                           ~13     '%3Cdiv%3E', !0
         12        CONCAT                                           ~14     ~13, '%3C%2Fdiv%3E'
         13        SEND_VAL_EX                                              ~14
         14        SEND_VAL_EX                                              8196
         15        DO_FCALL                                      0          
  163    16        NEW                                              $16     'DOMXpath'
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !2, $16
  166    20        INIT_METHOD_CALL                                         !2, 'query'
         21        SEND_VAL_EX                                              '%2F%2Ftext%28%29%5Btranslate%28normalize-space%28.%29%2C+%27%22%C2%A0%5C%27%2C+%27%27%29+%3D+%27%27%5D'
         22        DO_FCALL                                      0  $19     
         23        ASSIGN                                                   !3, $19
  167    24      > FE_RESET_R                                       $21     !3, ->35
         25    > > FE_FETCH_R                                       ~22     $21, !4, ->35
         26    >   ASSIGN                                                   !5, ~22
  168    27        FETCH_OBJ_R                                      ~24     !4, 'parentNode'
         28        FETCH_OBJ_R                                      ~25     ~24, 'parentNode'
         29        INIT_METHOD_CALL                                         ~25, 'removeChild'
         30        CHECK_FUNC_ARG                                           
         31        FETCH_OBJ_FUNC_ARG                               $26     !4, 'parentNode'
         32        SEND_FUNC_ARG                                            $26
         33        DO_FCALL                                      0          
  167    34      > JMP                                                      ->25
         35    >   FE_FREE                                                  $21
  171    36        INIT_METHOD_CALL                                         !2, 'query'
         37        SEND_VAL_EX                                              '.%2F%2Ftext%28%29%5Btranslate%28normalize-space%28.%29%2C+%27%22%C2%A0%5C%27%2C+%27%27%29+%21%3D+%27%27%5D'
         38        DO_FCALL                                      0  $28     
         39        ASSIGN                                                   !6, $28
  173    40        INIT_FCALL                                               'print_r'
         41        ROPE_INIT                                     3  ~32     'List+size%3A+'
         42        FETCH_OBJ_R                                      ~30     !6, 'length'
         43        ROPE_ADD                                      1  ~32     ~32, ~30
         44        ROPE_END                                      2  ~31     ~32, '+%0D%0A'
         45        SEND_VAL                                                 ~31
         46        DO_ICALL                                                 
  206    47        INIT_FCALL                                               'var_dump'
         48        INIT_FCALL                                               'flattendomnodes'
         49        SEND_REF                                                 !1
         50        SEND_VAR                                                 !6
         51        DO_FCALL                                      0  $35     
         52        SEND_VAR                                                 $35
         53        DO_ICALL                                                 
  207    54        INIT_FCALL                                               'var_dump'
         55        INIT_METHOD_CALL                                         !1, 'saveHTML'
         56        DO_FCALL                                      0  $37     
         57        SEND_VAR                                                 $37
         58        DO_ICALL                                                 
  209    59      > RETURN                                                   1

Function flattendomnodes:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 91
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 91
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 82
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 34
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 54
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 66
Branch analysis from position: 66
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 61
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 71, Position 2 = 61
Branch analysis from position: 71
Branch analysis from position: 61
Branch analysis from position: 82
Branch analysis from position: 91
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
filename:       /in/bajs1
function name:  flattenDOMNodes
number of ops:  94
compiled vars:  !0 = $doc, !1 = $list, !2 = $node, !3 = $i, !4 = $parent, !5 = $newNode, !6 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  175     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  176     2      > FE_RESET_R                                       $7      !1, ->91
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->91
          4    >   ASSIGN                                                   !3, ~8
  177     5        INIT_FCALL                                               'print_r'
          6        NOP                                                      
          7        FAST_CONCAT                                      ~10     !3, '%0D%0A'
          8        SEND_VAL                                                 ~10
          9        DO_ICALL                                                 
  178    10        FETCH_OBJ_R                                      ~12     !2, 'parentNode'
         11        ASSIGN                                                   !4, ~12
  180    12        FETCH_OBJ_R                                      ~14     !4, 'parentNode'
         13        FETCH_OBJ_R                                      ~15     !2, 'ownerDocument'
         14        FETCH_OBJ_R                                      ~16     ~15, 'documentElement'
         15        IS_NOT_IDENTICAL                                         ~14, ~16
         16      > JMPZ                                                     ~17, ->82
  181    17    >   FETCH_OBJ_R                                      ~18     !4, 'previousSibling'
         18        INSTANCEOF                                               ~18, 'DOMText'
         19      > JMPZ                                                     ~19, ->34
  182    20    >   INIT_FCALL                                               'print_r'
         21        SEND_VAL                                                 'Also+appending+happens%21%0D%0A'
         22        DO_ICALL                                                 
  183    23        FETCH_OBJ_R                                      ~21     !4, 'previousSibling'
         24        INIT_METHOD_CALL                                         ~21, 'appendData'
         25        CHECK_FUNC_ARG                                           
         26        FETCH_OBJ_FUNC_ARG                               $22     !2, 'nodeValue'
         27        SEND_FUNC_ARG                                            $22
         28        DO_FCALL                                      0          
  184    29        FETCH_OBJ_R                                      ~24     !4, 'parentNode'
         30        INIT_METHOD_CALL                                         ~24, 'removeChild'
         31        SEND_VAR_EX                                              !4
         32        DO_FCALL                                      0          
  181    33      > JMP                                                      ->82
  185    34    >   FETCH_OBJ_R                                      ~26     !4, 'nextSibling'
         35        INSTANCEOF                                               ~26, 'DOMText'
         36      > JMPZ                                                     ~27, ->54
  186    37    >   INIT_FCALL                                               'print_r'
         38        SEND_VAL                                                 'Also+inserting+happens%21%0D%0A'
         39        DO_ICALL                                                 
  187    40        FETCH_OBJ_R                                      ~29     !4, 'nextSibling'
         41        INIT_METHOD_CALL                                         ~29, 'insertData'
         42        SEND_VAL_EX                                              0
         43        ROPE_INIT                                     3  ~32     '+'
         44        FETCH_OBJ_R                                      ~30     !2, 'nodeValue'
         45        ROPE_ADD                                      1  ~32     ~32, ~30
         46        ROPE_END                                      2  ~31     ~32, '+'
         47        SEND_VAL_EX                                              ~31
         48        DO_FCALL                                      0          
  188    49        FETCH_OBJ_R                                      ~35     !4, 'parentNode'
         50        INIT_METHOD_CALL                                         ~35, 'removeChild'
         51        SEND_VAR_EX                                              !4
         52        DO_FCALL                                      0          
  185    53      > JMP                                                      ->82
  190    54    >   INIT_METHOD_CALL                                         !0, 'createTextNode'
         55        CHECK_FUNC_ARG                                           
         56        FETCH_OBJ_FUNC_ARG                               $37     !2, 'nodeValue'
         57        SEND_FUNC_ARG                                            $37
         58        DO_FCALL                                      0  $38     
         59        ASSIGN                                                   !5, $38
  192    60      > JMP                                                      ->66
  193    61    >   INIT_FCALL                                               'print_r'
         62        SEND_VAL                                                 'Up%2C+up%2C+up%21%0D%0A'
         63        DO_ICALL                                                 
  194    64        FETCH_OBJ_R                                      ~41     !4, 'parentNode'
         65        ASSIGN                                                   !4, ~41
  192    66    >   FETCH_OBJ_R                                      ~43     !4, 'parentNode'
         67        FETCH_OBJ_R                                      ~44     ~43, 'childNodes'
         68        FETCH_OBJ_R                                      ~45     ~44, 'length'
         69        IS_IDENTICAL                                             ~45, 1
         70      > JMPNZ                                                    ~46, ->61
  196    71    >   INIT_FCALL                                               'print_r'
         72        SEND_VAL                                                 'This+happens%0D%0A'
         73        DO_ICALL                                                 
  197    74        INIT_METHOD_CALL                                         !4, 'replaceChild'
         75        SEND_VAR_EX                                              !5
         76        FETCH_OBJ_R                                      ~48     !4, 'childNodes'
         77        INIT_METHOD_CALL                                         ~48, 'item'
         78        SEND_VAL_EX                                              0
         79        DO_FCALL                                      0  $49     
         80        SEND_VAR_NO_REF_EX                                       $49
         81        DO_FCALL                                      0          
  200    82    >   NEW                                              $51     'DOMXpath'
         83        SEND_VAR_EX                                              !0
         84        DO_FCALL                                      0          
         85        ASSIGN                                                   !6, $51
  201    86        INIT_METHOD_CALL                                         !6, 'query'
         87        SEND_VAL_EX                                              '.%2F%2Ftext%28%29%5Btranslate%28normalize-space%28.%29%2C+%27%22%C2%A0%5C%27%2C+%27%27%29+%21%3D+%27%27%5D'
         88        DO_FCALL                                      0  $54     
         89        ASSIGN                                                   !1, $54
  176    90      > JMP                                                      ->3
         91    >   FE_FREE                                                  $7
  203    92      > RETURN                                                   !1
  204    93*     > RETURN                                                   null

End of function flattendomnodes

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129.83 ms | 1485 KiB | 17 Q