3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CustomDOMDocument extends DOMDocument { } function localScope() { $doc = new CustomDOMDocument; $doc->loadHtml('<p>Test123</p>'); $xpath = new DOMXPath($doc); return $xpath; } $doc = new CustomDOMDocument; $doc->loadHtml('<p>Test123</p>'); $xpath = new DOMXPath($doc); var_dump(get_class($xpath->document)); $xpath = new DOMXPath(new CustomDOMDocument); var_dump(get_class($xpath->document)); $xpath = localScope(); var_dump(get_class($xpath->document));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XLInV
function name:  (null)
number of ops:  35
compiled vars:  !0 = $doc, !1 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $2      'CustomDOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   19     3        INIT_METHOD_CALL                                         !0, 'loadHtml'
          4        SEND_VAL_EX                                              '%3Cp%3ETest123%3C%2Fp%3E'
          5        DO_FCALL                                      0          
   20     6        NEW                                              $6      'DOMXPath'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   22    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~9      !1, 'document'
         12        GET_CLASS                                        ~10     ~9
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                                 
   25    15        NEW                                              $12     'DOMXPath'
         16        NEW                                              $13     'CustomDOMDocument'
         17        DO_FCALL                                      0          
         18        SEND_VAR_NO_REF_EX                                       $13
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !1, $12
   26    21        INIT_FCALL                                               'var_dump'
         22        FETCH_OBJ_R                                      ~17     !1, 'document'
         23        GET_CLASS                                        ~18     ~17
         24        SEND_VAL                                                 ~18
         25        DO_ICALL                                                 
   28    26        INIT_FCALL                                               'localscope'
         27        DO_FCALL                                      0  $20     
         28        ASSIGN                                                   !1, $20
   29    29        INIT_FCALL                                               'var_dump'
         30        FETCH_OBJ_R                                      ~22     !1, 'document'
         31        GET_CLASS                                        ~23     ~22
         32        SEND_VAL                                                 ~23
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Function localscope:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XLInV
function name:  localScope
number of ops:  12
compiled vars:  !0 = $doc, !1 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'CustomDOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   11     3        INIT_METHOD_CALL                                         !0, 'loadHtml'
          4        SEND_VAL_EX                                              '%3Cp%3ETest123%3C%2Fp%3E'
          5        DO_FCALL                                      0          
   12     6        NEW                                              $6      'DOMXPath'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   14    10      > RETURN                                                   !1
   15    11*     > RETURN                                                   null

End of function localscope

Class CustomDOMDocument: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.07 ms | 1403 KiB | 16 Q