3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Singelton { private static $instances; public static function getInstance($class_name, $create_function = null) { if(!isset(self::$instances[$class_name])) { if($create_function === null) self::$instances[$class_name] = new $class_name(); else self::$instances[$class_name] = $create_function(); } return self::$instances[$class_name]; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/18iGc
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E > > RETURN                                                   1

Class Singelton:
Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/18iGc
function name:  getInstance
number of ops:  24
compiled vars:  !0 = $class_name, !1 = $create_function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    9     2        FETCH_STATIC_PROP_IS                             ~2      'instances'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      ~2, !0
          4        BOOL_NOT                                         ~4      ~3
          5      > JMPZ                                                     ~4, ->20
   11     6    >   TYPE_CHECK                                    2          !1
          7      > JMPZ                                                     ~5, ->15
   12     8    >   FETCH_CLASS                                   0  $8      !0
          9        NEW                                              $9      $8
         10        DO_FCALL                                      0          
         11        FETCH_STATIC_PROP_W          unknown             $6      'instances'
         12        ASSIGN_DIM                                               $6, !0
         13        OP_DATA                                                  $9
         14      > JMP                                                      ->20
   14    15    >   INIT_DYNAMIC_CALL                                        !1
         16        DO_FCALL                                      0  $13     
         17        FETCH_STATIC_PROP_W          unknown             $11     'instances'
         18        ASSIGN_DIM                                               $11, !0
         19        OP_DATA                                                  $13
   17    20    >   FETCH_STATIC_PROP_R          unknown             ~14     'instances'
         21        FETCH_DIM_R                                      ~15     ~14, !0
         22      > RETURN                                                   ~15
   18    23*     > RETURN                                                   null

End of function getinstance

End of class Singelton.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.13 ms | 1395 KiB | 13 Q