3v4l.org

run code in 500+ PHP versions simultaneously
<?php $htmlString = '<p>Test</p> <h2>Test2</h2> <table> <thead> <tr> <td>Header 1</td> <td>Header 2</td> </tr> </thead> <tbody> <tr> <td>Col 1</td> <td>Col 2</td> </tr> </tbody> </table> <span>Test span </span> '; $dom = new DOMDocument(); $dom->loadHTML($htmlString, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $dom->preserveWhiteSpace = true; $tables = $dom->getElementsByTagName('table'); foreach($tables as $table) { var_dump($dom->saveHTML($table)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 23
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/YjkdT
function name:  (null)
number of ops:  25
compiled vars:  !0 = $htmlString, !1 = $dom, !2 = $tables, !3 = $table
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Cp%3ETest%3C%2Fp%3E%0A++++%3Ch2%3ETest2%3C%2Fh2%3E%0A++++%3Ctable%3E%0A++++++++%3Cthead%3E%0A++++++++++++%3Ctr%3E%0A++++++++++++++++%3Ctd%3EHeader+1%3C%2Ftd%3E%0A++++++++++++++++%3Ctd%3EHeader+2%3C%2Ftd%3E%0A++++++++++++%3C%2Ftr%3E%0A++++++++%3C%2Fthead%3E%0A++++++++%3Ctbody%3E%0A++++++++++++%3Ctr%3E%0A++++++++++++++++%3Ctd%3ECol+1%3C%2Ftd%3E%0A++++++++++++++++%3Ctd%3ECol+2%3C%2Ftd%3E%0A++++++++++++%3C%2Ftr%3E%0A++++++++%3C%2Ftbody%3E%0A++++%3C%2Ftable%3E%0A++++%3Cspan%3ETest+span+%3C%2Fspan%3E%0A'
   20     1        NEW                                                  $5      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $5
   21     4        INIT_METHOD_CALL                                             !1, 'loadHTML'
          5        SEND_VAR_EX                                                  !0
          6        SEND_VAL_EX                                                  8196
          7        DO_FCALL                                          0          
   22     8        ASSIGN_OBJ                                                   !1, 'preserveWhiteSpace'
          9        OP_DATA                                                      <true>
   23    10        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
         11        SEND_VAL_EX                                                  'table'
         12        DO_FCALL                                          0  $10     
         13        ASSIGN                                                       !2, $10
   24    14      > FE_RESET_R                                           $12     !2, ->23
         15    > > FE_FETCH_R                                                   $12, !3, ->23
   25    16    >   INIT_FCALL                                                   'var_dump'
         17        INIT_METHOD_CALL                                             !1, 'saveHTML'
         18        SEND_VAR_EX                                                  !3
         19        DO_FCALL                                          0  $13     
         20        SEND_VAR                                                     $13
         21        DO_ICALL                                                     
   24    22      > JMP                                                          ->15
         23    >   FE_FREE                                                      $12
   26    24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.26 ms | 1974 KiB | 14 Q