3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Connection {} class Singleton{ static public function get_instance(){ static $i; $i ?: $i = new Connection(); return $i; } } class A extends Singleton{} class B extends A{} var_dump(A::get_instance()); var_dump(B::get_instance());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4v3k7
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'A', 'get_instance'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   17     5        INIT_FCALL                                               'var_dump'
          6        INIT_STATIC_METHOD_CALL                                  'B', 'get_instance'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class Connection: [no user functions]
Class Singleton:
Function get_instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4v3k7
function name:  get_instance
number of ops:  9
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        JMP_SET                                          ~1      !0, ->6
          2        NEW                                              $2      'Connection'
          3        DO_FCALL                                      0          
          4        ASSIGN                                           ~4      !0, $2
          5        QM_ASSIGN                                        ~1      ~4
          6        FREE                                                     ~1
    8     7      > RETURN                                                   !0
    9     8*     > RETURN                                                   null

End of function get_instance

End of class Singleton.

Class A:
Function get_instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4v3k7
function name:  get_instance
number of ops:  9
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        JMP_SET                                          ~1      !0, ->6
          2        NEW                                              $2      'Connection'
          3        DO_FCALL                                      0          
          4        ASSIGN                                           ~4      !0, $2
          5        QM_ASSIGN                                        ~1      ~4
          6        FREE                                                     ~1
    8     7      > RETURN                                                   !0
    9     8*     > RETURN                                                   null

End of function get_instance

End of class A.

Class B:
Function get_instance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4v3k7
function name:  get_instance
number of ops:  9
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        JMP_SET                                          ~1      !0, ->6
          2        NEW                                              $2      'Connection'
          3        DO_FCALL                                      0          
          4        ASSIGN                                           ~4      !0, $2
          5        QM_ASSIGN                                        ~1      ~4
          6        FREE                                                     ~1
    8     7      > RETURN                                                   !0
    9     8*     > RETURN                                                   null

End of function get_instance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.97 ms | 1400 KiB | 15 Q