3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class A { protected static $self; private function __construct() { echo "parent constructor" ; static::$self = $this; } public static final function AI() { return new self; } } class B extends A { function c() { echo get_class(static::$self); } } $b = B::AI(); $b->c();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7aL3H
function name:  (null)
number of ops:  6
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_STATIC_METHOD_CALL                                  'B', 'AI'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'c'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7aL3H
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'parent+constructor'
    8     1        FETCH_THIS                                       ~1      
          2        ASSIGN_STATIC_PROP                                       'self'
          3        OP_DATA                                                  ~1
    9     4      > RETURN                                                   null

End of function __construct

Function ai:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7aL3H
function name:  AI
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                          self                $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   13     3*     > RETURN                                                   null

End of function ai

End of class A.

Class B:
Function c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7aL3H
function name:  c
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'self'
          1        GET_CLASS                                        ~1      ~0
          2        ECHO                                                     ~1
   21     3      > RETURN                                                   null

End of function c

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7aL3H
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'parent+constructor'
    8     1        FETCH_THIS                                       ~1      
          2        ASSIGN_STATIC_PROP                                       'self'
          3        OP_DATA                                                  ~1
    9     4      > RETURN                                                   null

End of function __construct

Function ai:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7aL3H
function name:  AI
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                          self                $0      
          1        DO_FCALL                                      0          
          2      > RETURN                                                   $0
   13     3*     > RETURN                                                   null

End of function ai

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.51 ms | 939 KiB | 14 Q