3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Singleton { protected static $instance; public static function getInstance(){ if (!isset(static::$instance)) { static $instance = 'aaa'; } return static::$instance; } } abstract class Abudabia { use Singleton; } class a1 extends Abudabia { public function set() { return 'allah ahbar'; } } class a2 extends Abudabia { public function get() { return 'algazira'; } } $a = a1::getInstance(); $b = a2::getInstance(); var_dump($a, $a->set(),$b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pEEPY
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                            'abudabia'
   18     1        DECLARE_CLASS                                            'a1', 'abudabia'
   26     2        DECLARE_CLASS                                            'a2', 'abudabia'
   34     3        INIT_STATIC_METHOD_CALL                                  'a1', 'getInstance'
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   35     6        INIT_STATIC_METHOD_CALL                                  'a2', 'getInstance'
          7        DO_FCALL                                      0  $4      
          8        ASSIGN                                                   !1, $4
   36     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        INIT_METHOD_CALL                                         !0, 'set'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class Singleton:
Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/pEEPY
function name:  getInstance
number of ops:  7
compiled vars:  !0 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~1      'instance'
          1        BOOL_NOT                                         ~2      ~1
          2      > JMPZ                                                     ~2, ->4
    7     3    >   BIND_STATIC                                              !0
   10     4    >   FETCH_STATIC_PROP_R          unknown             ~3      'instance'
          5      > RETURN                                                   ~3
   11     6*     > RETURN                                                   null

End of function getinstance

End of class Singleton.

Class Abudabia: [no user functions]
Class a1:
Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pEEPY
function name:  set
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   'allah+ahbar'
   23     1*     > RETURN                                                   null

End of function set

End of class a1.

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

End of function get

End of class a2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.54 ms | 1400 KiB | 15 Q