3v4l.org

run code in 300+ PHP versions simultaneously
<?php $div = '<div class="1"><span class="test">text text text</span></div> <div class="2"><span class="test">text text text</span></div> <div class="3"><span class="test">text text text</span></div>'; $dom = new \DOMDocument( '1.0', 'UTF-8' ); $dom->loadXML( "<content>{$div}</content>" ); /** @var \DOMNodeList $node */ $list = $dom->getElementsByTagName( 'p' ); /** @var \DOMElement $node */ $node = $list->item( $list->length -1 ); var_dump( $dom->saveXML( $node ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P8VZi
function name:  (null)
number of ops:  29
compiled vars:  !0 = $div, !1 = $dom, !2 = $list, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%221%22%3E%3Cspan+class%3D%22test%22%3Etext+text+text%3C%2Fspan%3E%3C%2Fdiv%3E%0A++++++++++++%3Cdiv+class%3D%222%22%3E%3Cspan+class%3D%22test%22%3Etext+text+text%3C%2Fspan%3E%3C%2Fdiv%3E%0A++++++++++++%3Cdiv+class%3D%223%22%3E%3Cspan+class%3D%22test%22%3Etext+text+text%3C%2Fspan%3E%3C%2Fdiv%3E'
    7     1        NEW                                              $5      'DOMDocument'
          2        SEND_VAL_EX                                              '1.0'
          3        SEND_VAL_EX                                              'UTF-8'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
    8     6        INIT_METHOD_CALL                                         !1, 'loadXML'
          7        ROPE_INIT                                     3  ~9      '%3Ccontent%3E'
          8        ROPE_ADD                                      1  ~9      ~9, !0
          9        ROPE_END                                      2  ~8      ~9, '%3C%2Fcontent%3E'
         10        SEND_VAL_EX                                              ~8
         11        DO_FCALL                                      0          
   10    12        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         13        SEND_VAL_EX                                              'p'
         14        DO_FCALL                                      0  $12     
         15        ASSIGN                                                   !2, $12
   12    16        INIT_METHOD_CALL                                         !2, 'item'
         17        FETCH_OBJ_R                                      ~14     !2, 'length'
         18        SUB                                              ~15     ~14, 1
         19        SEND_VAL_EX                                              ~15
         20        DO_FCALL                                      0  $16     
         21        ASSIGN                                                   !3, $16
   14    22        INIT_FCALL                                               'var_dump'
         23        INIT_METHOD_CALL                                         !1, 'saveXML'
         24        SEND_VAR_EX                                              !3
         25        DO_FCALL                                      0  $18     
         26        SEND_VAR                                                 $18
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.97 ms | 1396 KiB | 15 Q