3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Base { /** @return void */ abstract protected function _init(); /** @return void */ public function init() { /** @var bool $initialized */ static $initialized = false; if (!$initialized) { $this->_init(); $initialized = true; } } } class A extends Base { /** * @override * @return void */ protected function _init() {echo __CLASS__;} } class B extends Base { /** * @override * @return void */ protected function _init() {echo __CLASS__;} } $a = new A; $b = new B; $a->init(); $b->init();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TGeLO
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   34     3        NEW                                              $5      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   35     6        INIT_METHOD_CALL                                         !0, 'init'
          7        DO_FCALL                                      0          
   36     8        INIT_METHOD_CALL                                         !1, 'init'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

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

End of function _init

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/TGeLO
function name:  init
number of ops:  7
compiled vars:  !0 = $initialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->6
   11     3    >   INIT_METHOD_CALL                                         '_init'
          4        DO_FCALL                                      0          
   12     5        ASSIGN                                                   !0, <true>
   14     6    > > RETURN                                                   null

End of function init

End of class Base.

Class A:
Function _init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TGeLO
function name:  _init
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   ECHO                                                     'A'
          1      > RETURN                                                   null

End of function _init

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/TGeLO
function name:  init
number of ops:  7
compiled vars:  !0 = $initialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->6
   11     3    >   INIT_METHOD_CALL                                         '_init'
          4        DO_FCALL                                      0          
   12     5        ASSIGN                                                   !0, <true>
   14     6    > > RETURN                                                   null

End of function init

End of class A.

Class B:
Function _init:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TGeLO
function name:  _init
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   ECHO                                                     'B'
          1      > RETURN                                                   null

End of function _init

Function init:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/TGeLO
function name:  init
number of ops:  7
compiled vars:  !0 = $initialized
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->6
   11     3    >   INIT_METHOD_CALL                                         '_init'
          4        DO_FCALL                                      0          
   12     5        ASSIGN                                                   !0, <true>
   14     6    > > RETURN                                                   null

End of function init

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.81 ms | 1390 KiB | 13 Q