3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
180.06 ms | 1447 KiB | 13 Q