3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __construct() { echo "A::__construct() "; } public function A() { echo "A::A() "; } public function callme5() { static::__construct(); } public function callme4() { $classname = get_class($this); $this->$classname(); } } class B extends A { public function __construct() { echo "B::__construct() "; } public function B() { echo "B::B() "; } } class C extends A { public function __construct() { echo "C::__construct() "; } } class D extends A { public function D() { echo "D::D() "; } } echo "A: "; $obj = new A(); $obj->callme4(); $obj->callme5(); echo "\nB: "; $obj = new B(); $obj->callme4(); $obj->callme5(); echo "\nC: "; $obj = new C(); //$obj->callme4(); // This produces an error echo "(error) "; $obj->callme5(); echo "\nD: "; $obj = new D(); $obj->callme4(); $obj->callme5();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  (null)
number of ops:  32
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   ECHO                                                     'A%3A+'
   45     1        NEW                                              $1      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   46     4        INIT_METHOD_CALL                                         !0, 'callme4'
          5        DO_FCALL                                      0          
   47     6        INIT_METHOD_CALL                                         !0, 'callme5'
          7        DO_FCALL                                      0          
   49     8        ECHO                                                     '%0AB%3A+'
   50     9        NEW                                              $6      'B'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $6
   51    12        INIT_METHOD_CALL                                         !0, 'callme4'
         13        DO_FCALL                                      0          
   52    14        INIT_METHOD_CALL                                         !0, 'callme5'
         15        DO_FCALL                                      0          
   54    16        ECHO                                                     '%0AC%3A+'
   55    17        NEW                                              $11     'C'
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !0, $11
   57    20        ECHO                                                     '%28error%29+'
   58    21        INIT_METHOD_CALL                                         !0, 'callme5'
         22        DO_FCALL                                      0          
   60    23        ECHO                                                     '%0AD%3A+'
   61    24        NEW                                              $15     'D'
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !0, $15
   62    27        INIT_METHOD_CALL                                         !0, 'callme4'
         28        DO_FCALL                                      0          
   63    29        INIT_METHOD_CALL                                         !0, 'callme5'
         30        DO_FCALL                                      0          
         31      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'A%3A%3A__construct%28%29+'
    6     1      > RETURN                                                   null

End of function __construct

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  A
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'A%3A%3AA%28%29+'
   10     1      > RETURN                                                   null

End of function a

Function callme5:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme5
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   14     2      > RETURN                                                   null

End of function callme5

Function callme4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme4
number of ops:  6
compiled vars:  !0 = $classname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_THIS                                       ~1      
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
   18     3        INIT_METHOD_CALL                                         !0
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function callme4

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   ECHO                                                     'B%3A%3A__construct%28%29+'
   25     1      > RETURN                                                   null

End of function __construct

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  B
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   ECHO                                                     'B%3A%3AB%28%29+'
   29     1      > RETURN                                                   null

End of function b

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  A
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'A%3A%3AA%28%29+'
   10     1      > RETURN                                                   null

End of function a

Function callme5:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme5
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   14     2      > RETURN                                                   null

End of function callme5

Function callme4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme4
number of ops:  6
compiled vars:  !0 = $classname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_THIS                                       ~1      
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
   18     3        INIT_METHOD_CALL                                         !0
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function callme4

End of class B.

Class C:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   ECHO                                                     'C%3A%3A__construct%28%29+'
   35     1      > RETURN                                                   null

End of function __construct

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  A
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'A%3A%3AA%28%29+'
   10     1      > RETURN                                                   null

End of function a

Function callme5:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme5
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   14     2      > RETURN                                                   null

End of function callme5

Function callme4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme4
number of ops:  6
compiled vars:  !0 = $classname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_THIS                                       ~1      
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
   18     3        INIT_METHOD_CALL                                         !0
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function callme4

End of class C.

Class D:
Function d:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  D
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   ECHO                                                     'D%3A%3AD%28%29+'
   41     1      > RETURN                                                   null

End of function d

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'A%3A%3A__construct%28%29+'
    6     1      > RETURN                                                   null

End of function __construct

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  A
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'A%3A%3AA%28%29+'
   10     1      > RETURN                                                   null

End of function a

Function callme5:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme5
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_STATIC_METHOD_CALL                                  
          1        DO_FCALL                                      0          
   14     2      > RETURN                                                   null

End of function callme5

Function callme4:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TegfY
function name:  callme4
number of ops:  6
compiled vars:  !0 = $classname
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_THIS                                       ~1      
          1        GET_CLASS                                        ~2      ~1
          2        ASSIGN                                                   !0, ~2
   18     3        INIT_METHOD_CALL                                         !0
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function callme4

End of class D.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.16 ms | 1398 KiB | 13 Q