3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface ISingleton { public static function getInstance(): ISingleton; } abstract class Singleton implements ISingleton { private static $_instances = []; final private function __construct () {} final private function __clone() {} final private function __wakeup() {} final public static function getInstance() : ISingleton { self::$_instances[static::class] = self::$_instances[static::class] ?? new static(); return self::$_instances[static::class]; } } class Flextype extends Singleton { } var_export(Flextype::getInstance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m7AbZ
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                                'singleton'
   23     1        DECLARE_CLASS                                                'flextype', 'singleton'
   27     2        INIT_FCALL                                                   'var_export'
          3        INIT_STATIC_METHOD_CALL                                      'Flextype', 'getInstance'
          4        DO_FCALL                                          0  $0      
          5        SEND_VAR                                                     $0
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

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

End of function getinstance

End of class ISingleton.

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

End of function __construct

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

End of function __clone

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

End of function __wakeup

Function getinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m7AbZ
function name:  getInstance
number of ops:  18
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   FETCH_CLASS_NAME                                     ~1      
          1        FETCH_CLASS_NAME                                     ~4      
          2        FETCH_STATIC_PROP_IS                                 ~3      '_instances'
          3        FETCH_DIM_IS                                         ~5      ~3, ~4
          4        COALESCE                                             ~6      ~5
          5        NEW                              static              $7      
          6        DO_FCALL                                          0          
          7        QM_ASSIGN                                            ~6      $7
          8        FETCH_STATIC_PROP_W              global              $0      '_instances'
          9        ASSIGN_DIM                                                   $0, ~1
         10        OP_DATA                                                      ~6
   18    11        FETCH_CLASS_NAME                                     ~10     
         12        FETCH_STATIC_PROP_R              unknown             ~9      '_instances'
         13        FETCH_DIM_R                                          ~11     ~9, ~10
         14        VERIFY_RETURN_TYPE                                           ~11
         15      > RETURN                                                       ~11
   19    16*       VERIFY_RETURN_TYPE                                           
         17*     > RETURN                                                       null

End of function getinstance

End of class Singleton.

Class Flextype: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.87 ms | 2193 KiB | 14 Q