3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = '<div>abc<br>def</div>'; $dom = \Dom\HTMLDocument::createFromString($html, options: LIBXML_NOERROR|LIBXML_HTML_NOIMPLIED); var_dump($dom->saveHtml()); $xpath = new \Dom\XPath($dom); //$xpath->registerNamespace('xhtml', 'http://www.w3.org/1999/xhtml'); var_dump($xpath->query('//div')->length); $dom = new \DOMDocument(encoding: 'UTF-8'); $dom->loadHTML($html, LIBXML_NOERROR| LIBXML_HTML_NODEFDTD|LIBXML_HTML_NOIMPLIED); var_dump($dom->saveHtml()); $xpath = new \DOMXPath($dom); var_dump($xpath->query('//div')->length);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Tgm1W
function name:  (null)
number of ops:  48
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Cdiv%3Eabc%3Cbr%3Edef%3C%2Fdiv%3E'
    3     1        INIT_STATIC_METHOD_CALL                                      'Dom%5CHTMLDocument', 'createFromString'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     8224
          4        DO_FCALL                                          0  $4      
          5        ASSIGN                                                       !1, $4
    4     6        INIT_FCALL                                                   'var_dump'
          7        INIT_METHOD_CALL                                             !1, 'saveHtml'
          8        DO_FCALL                                          0  $6      
          9        SEND_VAR                                                     $6
         10        DO_ICALL                                                     
    5    11        NEW                                                  $8      'Dom%5CXPath'
         12        SEND_VAR_EX                                                  !1
         13        DO_FCALL                                          0          
         14        ASSIGN                                                       !2, $8
    8    15        INIT_FCALL                                                   'var_dump'
         16        INIT_METHOD_CALL                                             !2, 'query'
         17        SEND_VAL_EX                                                  '%2F%2Fdiv'
         18        DO_FCALL                                          0  $11     
         19        FETCH_OBJ_R                                          ~12     $11, 'length'
         20        SEND_VAL                                                     ~12
         21        DO_ICALL                                                     
   11    22        NEW                                                  $14     'DOMDocument'
         23        SEND_VAL_EX                                                  'UTF-8', 'encoding'
         24        CHECK_UNDEF_ARGS                                             
         25        DO_FCALL                                          1          
         26        ASSIGN                                                       !1, $14
   12    27        INIT_METHOD_CALL                                             !1, 'loadHTML'
         28        SEND_VAR_EX                                                  !0
         29        SEND_VAL_EX                                                  8228
         30        DO_FCALL                                          0          
   13    31        INIT_FCALL                                                   'var_dump'
         32        INIT_METHOD_CALL                                             !1, 'saveHtml'
         33        DO_FCALL                                          0  $18     
         34        SEND_VAR                                                     $18
         35        DO_ICALL                                                     
   14    36        NEW                                                  $20     'DOMXPath'
         37        SEND_VAR_EX                                                  !1
         38        DO_FCALL                                          0          
         39        ASSIGN                                                       !2, $20
   15    40        INIT_FCALL                                                   'var_dump'
         41        INIT_METHOD_CALL                                             !2, 'query'
         42        SEND_VAL_EX                                                  '%2F%2Fdiv'
         43        DO_FCALL                                          0  $23     
         44        FETCH_OBJ_R                                          ~24     $23, 'length'
         45        SEND_VAL                                                     ~24
         46        DO_ICALL                                                     
         47      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.13 ms | 1285 KiB | 14 Q