3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyText extends DOMText { public $id; public static $next = 0; function __construct($text) { parent::__construct($text); $this->id = MyText::$next++; echo "Constructing DOMText #" . $this->id . ": " . $this->wholeText . "\n"; } function __destruct() { echo "Destructing DOMText #" . $this->id . ": " . $this->wholeText . "\n"; } } class MyElement extends DOMElement { public $id; public static $next = 0; function __construct($name) { parent::__construct($name); $this->id = MyText::$next++; echo "Constructing DOMElement #" . $this->id . ": " . $this->tagName . "\n"; } function __destruct() { echo "Destructing DOMElement #" . $this->id . ": " . $this->tagName . "\n"; } function info() { echo "Querying DOMElement #" . $this->id . ": " . $this->tagName . "\n"; } } function foo() { echo "Enter foo()\n"; $doc = new DOMDocument; $dom->registerNodeClass('DOMText', 'MyText'); $dom->registerNodeClass('DOMElement', 'MyElement'); $dom->appendChild($dom->createElement('foo')); $dom->appendChild($dom->createElement('bar')); echo "Leave foo()\n"; return $dom; } function bar() { echo "Enter bar()\n"; $d = foo(); $fooList = $d->getElementsByTagName('foo'); foreach ($fooList as $foo) { $foo->info(); } echo "Leave bar()\n"; } echo "Enter main()\n"; bar(); echo "Leave main()\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   59     0  E >   ECHO                                                     'Enter+main%28%29%0A'
   60     1        INIT_FCALL                                               'bar'
          2        DO_FCALL                                      0          
   61     3        ECHO                                                     'Leave+main%28%29%0A'
          4      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  foo
number of ops:  27
compiled vars:  !0 = $doc, !1 = $dom
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   ECHO                                                     'Enter+foo%28%29%0A'
   37     1        NEW                                              $2      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   38     4        INIT_METHOD_CALL                                         !1, 'registerNodeClass'
          5        SEND_VAL_EX                                              'DOMText'
          6        SEND_VAL_EX                                              'MyText'
          7        DO_FCALL                                      0          
   39     8        INIT_METHOD_CALL                                         !1, 'registerNodeClass'
          9        SEND_VAL_EX                                              'DOMElement'
         10        SEND_VAL_EX                                              'MyElement'
         11        DO_FCALL                                      0          
   41    12        INIT_METHOD_CALL                                         !1, 'appendChild'
         13        INIT_METHOD_CALL                                         !1, 'createElement'
         14        SEND_VAL_EX                                              'foo'
         15        DO_FCALL                                      0  $7      
         16        SEND_VAR_NO_REF_EX                                       $7
         17        DO_FCALL                                      0          
   42    18        INIT_METHOD_CALL                                         !1, 'appendChild'
         19        INIT_METHOD_CALL                                         !1, 'createElement'
         20        SEND_VAL_EX                                              'bar'
         21        DO_FCALL                                      0  $9      
         22        SEND_VAR_NO_REF_EX                                       $9
         23        DO_FCALL                                      0          
   44    24        ECHO                                                     'Leave+foo%28%29%0A'
   45    25      > RETURN                                                   !1
   46    26*     > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/qmr52
function name:  bar
number of ops:  16
compiled vars:  !0 = $d, !1 = $fooList, !2 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   ECHO                                                     'Enter+bar%28%29%0A'
   50     1        INIT_FCALL                                               'foo'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !0, $3
   52     4        INIT_METHOD_CALL                                         !0, 'getElementsByTagName'
          5        SEND_VAL_EX                                              'foo'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   53     8      > FE_RESET_R                                       $7      !1, ->13
          9    > > FE_FETCH_R                                               $7, !2, ->13
   54    10    >   INIT_METHOD_CALL                                         !2, 'info'
         11        DO_FCALL                                      0          
   53    12      > JMP                                                      ->9
         13    >   FE_FREE                                                  $7
   56    14        ECHO                                                     'Leave+bar%28%29%0A'
   57    15      > RETURN                                                   null

End of function bar

Class MyText:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  __construct
number of ops:  15
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    8     4        POST_INC_STATIC_PROP                             ~3      'next', 'MyText'
          5        ASSIGN_OBJ                                               'id'
          6        OP_DATA                                                  ~3
    9     7        FETCH_OBJ_R                                      ~4      'id'
          8        CONCAT                                           ~5      'Constructing+DOMText+%23', ~4
          9        CONCAT                                           ~6      ~5, '%3A+'
         10        FETCH_OBJ_R                                      ~7      'wholeText'
         11        CONCAT                                           ~8      ~6, ~7
         12        CONCAT                                           ~9      ~8, '%0A'
         13        ECHO                                                     ~9
   10    14      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1        CONCAT                                           ~1      'Destructing+DOMText+%23', ~0
          2        CONCAT                                           ~2      ~1, '%3A+'
          3        FETCH_OBJ_R                                      ~3      'wholeText'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '%0A'
          6        ECHO                                                     ~5
   14     7      > RETURN                                                   null

End of function __destruct

End of class MyText.

Class MyElement:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  __construct
number of ops:  15
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_STATIC_METHOD_CALL                                  
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   22     4        POST_INC_STATIC_PROP                             ~3      'next', 'MyText'
          5        ASSIGN_OBJ                                               'id'
          6        OP_DATA                                                  ~3
   23     7        FETCH_OBJ_R                                      ~4      'id'
          8        CONCAT                                           ~5      'Constructing+DOMElement+%23', ~4
          9        CONCAT                                           ~6      ~5, '%3A+'
         10        FETCH_OBJ_R                                      ~7      'tagName'
         11        CONCAT                                           ~8      ~6, ~7
         12        CONCAT                                           ~9      ~8, '%0A'
         13        ECHO                                                     ~9
   24    14      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1        CONCAT                                           ~1      'Destructing+DOMElement+%23', ~0
          2        CONCAT                                           ~2      ~1, '%3A+'
          3        FETCH_OBJ_R                                      ~3      'tagName'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '%0A'
          6        ECHO                                                     ~5
   28     7      > RETURN                                                   null

End of function __destruct

Function info:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qmr52
function name:  info
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1        CONCAT                                           ~1      'Querying+DOMElement+%23', ~0
          2        CONCAT                                           ~2      ~1, '%3A+'
          3        FETCH_OBJ_R                                      ~3      'tagName'
          4        CONCAT                                           ~4      ~2, ~3
          5        CONCAT                                           ~5      ~4, '%0A'
          6        ECHO                                                     ~5
   32     7      > RETURN                                                   null

End of function info

End of class MyElement.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
272.43 ms | 1411 KiB | 16 Q