3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument; $doc->loadHTML('<html><body id="x"><div id="y"></div></body></html>'); $body = $doc->getElementById('x'); $div = $doc->getElementById('y'); $node = (new DOMXPath($doc))->query('.//*[@id="y"]', $doc->documentElement)->item(0); echo '0: ' . ( $node ? $node->tagName : 'null' ) . PHP_EOL; $body->removeChild($div); $node = (new DOMXPath($doc))->query('.//*[@id="y"]', $doc->documentElement)->item(0); echo '1: ' . ( $node ? $node->tagName : 'null' ) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 55
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 55
Branch analysis from position: 52
Branch analysis from position: 55
filename:       /in/Q0iA9
function name:  (null)
number of ops:  60
compiled vars:  !0 = $doc, !1 = $body, !2 = $div, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        INIT_METHOD_CALL                                         !0, 'loadHTML'
          4        SEND_VAL_EX                                              '%3Chtml%3E%3Cbody+id%3D%22x%22%3E%3Cdiv+id%3D%22y%22%3E%3C%2Fdiv%3E%3C%2Fbody%3E%3C%2Fhtml%3E'
          5        DO_FCALL                                      0          
    5     6        INIT_METHOD_CALL                                         !0, 'getElementById'
          7        SEND_VAL_EX                                              'x'
          8        DO_FCALL                                      0  $8      
          9        ASSIGN                                                   !1, $8
    6    10        INIT_METHOD_CALL                                         !0, 'getElementById'
         11        SEND_VAL_EX                                              'y'
         12        DO_FCALL                                      0  $10     
         13        ASSIGN                                                   !2, $10
    7    14        NEW                                              $12     'DOMXPath'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0          
         17        INIT_METHOD_CALL                                         $12, 'query'
         18        SEND_VAL_EX                                              '.%2F%2F%2A%5B%40id%3D%22y%22%5D'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_OBJ_FUNC_ARG                               $14     !0, 'documentElement'
         21        SEND_FUNC_ARG                                            $14
         22        DO_FCALL                                      0  $15     
         23        INIT_METHOD_CALL                                         $15, 'item'
         24        SEND_VAL_EX                                              0
         25        DO_FCALL                                      0  $16     
         26        ASSIGN                                                   !3, $16
    8    27      > JMPZ                                                     !3, ->31
         28    >   FETCH_OBJ_R                                      ~18     !3, 'tagName'
         29        QM_ASSIGN                                        ~19     ~18
         30      > JMP                                                      ->32
         31    >   QM_ASSIGN                                        ~19     'null'
         32    >   CONCAT                                           ~20     '0%3A+', ~19
         33        CONCAT                                           ~21     ~20, '%0A'
         34        ECHO                                                     ~21
    9    35        INIT_METHOD_CALL                                         !1, 'removeChild'
         36        SEND_VAR_EX                                              !2
         37        DO_FCALL                                      0          
   10    38        NEW                                              $23     'DOMXPath'
         39        SEND_VAR_EX                                              !0
         40        DO_FCALL                                      0          
         41        INIT_METHOD_CALL                                         $23, 'query'
         42        SEND_VAL_EX                                              '.%2F%2F%2A%5B%40id%3D%22y%22%5D'
         43        CHECK_FUNC_ARG                                           
         44        FETCH_OBJ_FUNC_ARG                               $25     !0, 'documentElement'
         45        SEND_FUNC_ARG                                            $25
         46        DO_FCALL                                      0  $26     
         47        INIT_METHOD_CALL                                         $26, 'item'
         48        SEND_VAL_EX                                              0
         49        DO_FCALL                                      0  $27     
         50        ASSIGN                                                   !3, $27
   11    51      > JMPZ                                                     !3, ->55
         52    >   FETCH_OBJ_R                                      ~29     !3, 'tagName'
         53        QM_ASSIGN                                        ~30     ~29
         54      > JMP                                                      ->56
         55    >   QM_ASSIGN                                        ~30     'null'
         56    >   CONCAT                                           ~31     '1%3A+', ~30
         57        CONCAT                                           ~32     ~31, '%0A'
         58        ECHO                                                     ~32
   12    59      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.6 ms | 1399 KiB | 13 Q