3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = " <html> <body> <div id='div1'></div> <div id='div2'> Some text <span>Inside a span</span> <div>Nested div</div> </div> <div id='div3'> Some text <span>Inside a span</span> <div>Nested div</div> </div> </body> </html>"; $doc = new DOMDocument(); $doc->loadHTML($html); $div = $doc->getElementById("div2"); $div = $doc->getElementById("div3"); echo $div->ownerDocument->saveHTML($div);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/773je
function name:  (null)
number of ops:  21
compiled vars:  !0 = $html, !1 = $doc, !2 = $div
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%0A%3Chtml%3E%0A++++%3Cbody%3E%0A++++++++%3Cdiv+id%3D%27div1%27%3E%3C%2Fdiv%3E%0A++++++++%3Cdiv+id%3D%27div2%27%3E%0A++++++++++++Some+text%0A++++++++++++%3Cspan%3EInside+a+span%3C%2Fspan%3E%0A++++++++++++%3Cdiv%3ENested+div%3C%2Fdiv%3E%0A++++++++%3C%2Fdiv%3E%0A++++++++%3Cdiv+id%3D%27div3%27%3E%0A++++++++++++Some+text%0A++++++++++++%3Cspan%3EInside+a+span%3C%2Fspan%3E%0A++++++++++++%3Cdiv%3ENested+div%3C%2Fdiv%3E%0A++++++++%3C%2Fdiv%3E%0A++++%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   19     1        NEW                                              $4      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
   20     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   21     7        INIT_METHOD_CALL                                         !1, 'getElementById'
          8        SEND_VAL_EX                                              'div2'
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !2, $8
   22    11        INIT_METHOD_CALL                                         !1, 'getElementById'
         12        SEND_VAL_EX                                              'div3'
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !2, $10
   24    15        FETCH_OBJ_R                                      ~12     !2, 'ownerDocument'
         16        INIT_METHOD_CALL                                         ~12, 'saveHTML'
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0  $13     
         19        ECHO                                                     $13
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.31 ms | 1394 KiB | 13 Q