3v4l.org

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

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

End of function getinstance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.21 ms | 1405 KiB | 15 Q