3v4l.org

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

End of function waa

Class CustomDOMDocument:
Function geterrors:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/obo6S
function name:  getErrors
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   42
    9     1*     > RETURN                                                   null

End of function geterrors

End of class CustomDOMDocument.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.96 ms | 1403 KiB | 16 Q