3v4l.org

run code in 300+ PHP versions simultaneously
<?php $body = "&nbps; &#8820; <h1>h1</h1> Paragraph <a href=\"http://google.com/\">link</a> <strong>Bold</strong> <em>italic</em> <em><strong>bolditalic</strong></em>&nbsp;<span style=\"background-color: #ffff00; \"></span> <h2>h2</h2> Paragraph <span style=\"font-size: xx-small;\">size1</span> <span style=\"font-size: x-small;\">size2</span> <span style=\"font-size: medium;\">size4</span> <h3>h3</h3> Paragraph <span style=\"text-decoration: underline;\">underline</span> <span style=\"text-decoration: line-through;\">strikethrough</span> <span style=\"color: #ff0000;\">color</span> <span style=\"background-color: #ffff00; \">background</span> <blockquote>Blockquoted paragraph</blockquote> Paragraph following blockquote <ul> <li>Unordered</li> <li>List</li> </ul> Paragraph between lists <ol> <li>Ordered</li> <li>List</li> </ol> Paragraph between lists <ul> <li>OL list</li> <li>nested <ol> <li>inside a</li> <li>UL list</li> </ol></li> </ul> Paragraph between lists <table border=\"0\"> <tbody> <tr> </tr> <tr> <td>Table with</td> <td></td> </tr> <tr> <td></td> <td>border=0</td> </tr> </tbody> </table> Paragraph <ol> <li>UL list</li> <li>nested <ul> <li>inside a</li> <li>OL list</li> </ul> </li> </ol> Paragraph between tables <table border=\"1\" cellpadding=\"5\"> <tbody> <tr> <td>Table with border=1</td> <td></td> </tr> <tr> <td></td> <td>cellpadding = 5</td> </tr> </tbody> </table> Paragraph between tables <table border=\"2\"> <tbody> <tr> <td>Table with</td> <td></td> </tr> <tr> <td></td> <td>border=2</td> </tr> </tbody> </table>"; $html = "<html><meta http-equiv='content-type' content='text/html; charset=UTF-8'><body>$body</body></html>"; $doc = new DOMDocument(); libxml_use_internal_errors(true); $doc->loadHTML($html); $xpath = new DOMXPath($doc); $nodeList = $xpath->query('//body[1]'); echo ((get_class($nodeList->item(0)) == 'DOMElement') ? 'PASS' : 'FAIL');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XUin1
function name:  (null)
number of ops:  33
compiled vars:  !0 = $body, !1 = $html, !2 = $doc, !3 = $xpath, !4 = $nodeList
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%26nbps%3B%0A%26%238820%3B%0A%3Ch1%3Eh1%3C%2Fh1%3E%0AParagraph+%3Ca+href%3D%22http%3A%2F%2Fgoogle.com%2F%22%3Elink%3C%2Fa%3E+%3Cstrong%3EBold%3C%2Fstrong%3E+%3Cem%3Eitalic%3C%2Fem%3E+%3Cem%3E%3Cstrong%3Ebolditalic%3C%2Fstrong%3E%3C%2Fem%3E%26nbsp%3B%3Cspan+style%3D%22background-color%3A+%23ffff00%3B+%22%3E%3C%2Fspan%3E%0A%3Ch2%3Eh2%3C%2Fh2%3E%0AParagraph+%3Cspan+style%3D%22font-size%3A+xx-small%3B%22%3Esize1%3C%2Fspan%3E+%3Cspan+style%3D%22font-size%3A+x-small%3B%22%3Esize2%3C%2Fspan%3E+%3Cspan+style%3D%22font-size%3A+medium%3B%22%3Esize4%3C%2Fspan%3E%0A%3Ch3%3Eh3%3C%2Fh3%3E%0AParagraph+%3Cspan+style%3D%22text-decoration%3A+underline%3B%22%3Eunderline%3C%2Fspan%3E+%3Cspan+style%3D%22text-decoration%3A+line-through%3B%22%3Estrikethrough%3C%2Fspan%3E+%3Cspan+style%3D%22color%3A+%23ff0000%3B%22%3Ecolor%3C%2Fspan%3E+%3Cspan+style%3D%22background-color%3A+%23ffff00%3B+%22%3Ebackground%3C%2Fspan%3E%0A%3Cblockquote%3EBlockquoted+paragraph%3C%2Fblockquote%3E%0AParagraph+following+blockquote%0A%3Cul%3E%0A++++%3Cli%3EUnordered%3C%2Fli%3E%0A++++%3Cli%3EList%3C%2Fli%3E%0A%3C%2Ful%3E%0AParagraph+between+lists%0A%3Col%3E%0A++++%3Cli%3EOrdered%3C%2Fli%3E%0A++++%3Cli%3EList%3C%2Fli%3E%0A%3C%2Fol%3E%0AParagraph+between+lists%0A%3Cul%3E%0A++++%3Cli%3EOL+list%3C%2Fli%3E%0A++++%3Cli%3Enested%0A++++++++%3Col%3E%0A++++++++++++%3Cli%3Einside+a%3C%2Fli%3E%0A++++++++++++%3Cli%3EUL+list%3C%2Fli%3E%0A++++++++%3C%2Fol%3E%3C%2Fli%3E%0A%3C%2Ful%3E%0AParagraph+between+lists%0A%3Ctable+border%3D%220%22%3E%0A++++%3Ctbody%3E%0A++++++++%3Ctr%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3ETable+with%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%3C%2Ftd%3E%0A++++++++++++%3Ctd%3Eborder%3D0%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++%3C%2Ftbody%3E%0A%3C%2Ftable%3E%0AParagraph%0A%3Col%3E%0A++++%3Cli%3EUL+list%3C%2Fli%3E%0A++++%3Cli%3Enested%0A++++++++%3Cul%3E%0A++++++++++++%3Cli%3Einside+a%3C%2Fli%3E%0A++++++++++++%3Cli%3EOL+list%3C%2Fli%3E%0A++++++++%3C%2Ful%3E%0A++++%3C%2Fli%3E%0A%3C%2Fol%3E%0AParagraph+between+tables%0A%3Ctable+border%3D%221%22+cellpadding%3D%225%22%3E%0A++++%3Ctbody%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3ETable+with+border%3D1%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%3C%2Ftd%3E%0A++++++++++++%3Ctd%3Ecellpadding+%3D+5%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++%3C%2Ftbody%3E%0A%3C%2Ftable%3E%0AParagraph+between+tables%0A%3Ctable+border%3D%222%22%3E%0A++++%3Ctbody%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3ETable+with%3C%2Ftd%3E%0A++++++++++++%3Ctd%3E%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++++++%3Ctr%3E%0A++++++++++++%3Ctd%3E%3C%2Ftd%3E%0A++++++++++++%3Ctd%3Eborder%3D2%3C%2Ftd%3E%0A++++++++%3C%2Ftr%3E%0A++++%3C%2Ftbody%3E%0A%3C%2Ftable%3E'
   83     1        ROPE_INIT                                     3  ~7      '%3Chtml%3E%3Cmeta+http-equiv%3D%27content-type%27+content%3D%27text%2Fhtml%3B+charset%3DUTF-8%27%3E%3Cbody%3E'
          2        ROPE_ADD                                      1  ~7      ~7, !0
          3        ROPE_END                                      2  ~6      ~7, '%3C%2Fbody%3E%3C%2Fhtml%3E'
          4        ASSIGN                                                   !1, ~6
   84     5        NEW                                              $10     'DOMDocument'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $10
   85     8        INIT_FCALL                                               'libxml_use_internal_errors'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                                 
   86    11        INIT_METHOD_CALL                                         !2, 'loadHTML'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   87    14        NEW                                              $15     'DOMXPath'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !3, $15
   88    18        INIT_METHOD_CALL                                         !3, 'query'
         19        SEND_VAL_EX                                              '%2F%2Fbody%5B1%5D'
         20        DO_FCALL                                      0  $18     
         21        ASSIGN                                                   !4, $18
   89    22        INIT_METHOD_CALL                                         !4, 'item'
         23        SEND_VAL_EX                                              0
         24        DO_FCALL                                      0  $20     
         25        GET_CLASS                                        ~21     $20
         26        IS_EQUAL                                                 ~21, 'DOMElement'
         27      > JMPZ                                                     ~22, ->30
         28    >   QM_ASSIGN                                        ~23     'PASS'
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~23     'FAIL'
         31    >   ECHO                                                     ~23
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.1 ms | 1392 KiB | 15 Q