3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class T { static protected $instanses; final private function __construct(){ } public static function getInstance() { if (!isset(static::$instanses)) { static::$instanses = new static; } return static::$instanses; } } class A extends T { static protected $instanses; } class B extends A { static protected $instanses; } $t = A::getInstance(); var_dump($t); $t1 = B::getInstance(); var_dump($t1); new B(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SvNnt
function name:  (null)
number of ops:  16
compiled vars:  !0 = $t, !1 = $t1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_STATIC_METHOD_CALL                                  'A', 'getInstance'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   32     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   34     6        INIT_STATIC_METHOD_CALL                                  'B', 'getInstance'
          7        DO_FCALL                                      0  $5      
          8        ASSIGN                                                   !1, $5
   35     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
   37    12        NEW                                              $8      'B'
         13        DO_FCALL                                      0          
         14        FREE                                                     $8
   40    15      > RETURN                                                   1

Class T:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SvNnt
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     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/SvNnt
function name:  getInstance
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~0      'instanses'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->7
   14     3    >   NEW                          static              $3      
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instanses'
          6        OP_DATA                                                  $3
   17     7    >   FETCH_STATIC_PROP_R          unknown             ~5      'instanses'
          8      > RETURN                                                   ~5
   18     9*     > RETURN                                                   null

End of function getinstance

End of class T.

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SvNnt
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     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/SvNnt
function name:  getInstance
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~0      'instanses'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->7
   14     3    >   NEW                          static              $3      
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instanses'
          6        OP_DATA                                                  $3
   17     7    >   FETCH_STATIC_PROP_R          unknown             ~5      'instanses'
          8      > RETURN                                                   ~5
   18     9*     > RETURN                                                   null

End of function getinstance

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/SvNnt
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     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/SvNnt
function name:  getInstance
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~0      'instanses'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->7
   14     3    >   NEW                          static              $3      
          4        DO_FCALL                                      0          
          5        ASSIGN_STATIC_PROP                                       'instanses'
          6        OP_DATA                                                  $3
   17     7    >   FETCH_STATIC_PROP_R          unknown             ~5      'instanses'
          8      > RETURN                                                   ~5
   18     9*     > RETURN                                                   null

End of function getinstance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.18 ms | 1392 KiB | 15 Q