3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<CDATA <p>World!</p> CDATA; $doc = new DOMDocument(); $doc->loadHTML($html); $children = $doc->childNodes; $pTag = $doc->getElementsByTagName('p')[0]; $worldTextNode = $pTag->childNodes[0]; $helloTextNode = new DOMElement('span', 'Hello '); $worldTextNode->parentNode->insertBefore($helloTextNode, $worldTextNode); echo is_null($helloTextNode->ownerDocument) ? 'Missing owner doc' : 'Has owner doc';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GR8IX
function name:  (null)
number of ops:  35
compiled vars:  !0 = $html, !1 = $doc, !2 = $children, !3 = $pTag, !4 = $worldTextNode, !5 = $helloTextNode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3EWorld%21%3C%2Fp%3E'
    7     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
    8     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
    9     7        FETCH_OBJ_R                                      ~11     !1, 'childNodes'
          8        ASSIGN                                                   !2, ~11
   11     9        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         10        SEND_VAL_EX                                              'p'
         11        DO_FCALL                                      0  $13     
         12        FETCH_DIM_R                                      ~14     $13, 0
         13        ASSIGN                                                   !3, ~14
   12    14        FETCH_OBJ_R                                      ~16     !3, 'childNodes'
         15        FETCH_DIM_R                                      ~17     ~16, 0
         16        ASSIGN                                                   !4, ~17
   14    17        NEW                                              $19     'DOMElement'
         18        SEND_VAL_EX                                              'span'
         19        SEND_VAL_EX                                              'Hello+'
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !5, $19
   15    22        FETCH_OBJ_R                                      ~22     !4, 'parentNode'
         23        INIT_METHOD_CALL                                         ~22, 'insertBefore'
         24        SEND_VAR_EX                                              !5
         25        SEND_VAR_EX                                              !4
         26        DO_FCALL                                      0          
   17    27        FETCH_OBJ_R                                      ~24     !5, 'ownerDocument'
         28        TYPE_CHECK                                    2          ~24
         29      > JMPZ                                                     ~25, ->32
         30    >   QM_ASSIGN                                        ~26     'Missing+owner+doc'
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~26     'Has+owner+doc'
         33    >   ECHO                                                     ~26
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.23 ms | 1000 KiB | 13 Q