3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ABase { const I_AM_CONSTANT = 'shazam'; private static $instance = null; public function getInstance() { if(self::$instance == null) { self::$instance = new ABase(); } } private function __construct() { } } class B extends ABase { const I_AM_CONSTANT = 'kaboom!'; private static $instance = null; private function __construct() { } } $bInstance = B::getInstance(); echo B::I_AM_CONSTANT;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hI980
function name:  (null)
number of ops:  5
compiled vars:  !0 = $bInstance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                  'B', 'getInstance'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   29     3        ECHO                                                     'kaboom%21'
          4      > RETURN                                                   1

Class ABase:
Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/hI980
function name:  getInstance
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        IS_EQUAL                                                 ~0, null
          2      > JMPZ                                                     ~1, ->7
   10     3    >   NEW                                              $3      'ABase'
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instance'
          6        OP_DATA                                                  $3
   12     7    > > RETURN                                                   null

End of function getinstance

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

End of function __construct

End of class ABase.

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

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/hI980
function name:  getInstance
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instance'
          1        IS_EQUAL                                                 ~0, null
          2      > JMPZ                                                     ~1, ->7
   10     3    >   NEW                                              $3      'ABase'
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instance'
          6        OP_DATA                                                  $3
   12     7    > > RETURN                                                   null

End of function getinstance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.66 ms | 1399 KiB | 13 Q