3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test1 { public static function func() { static $val; if (!isset($val)) { $val = 1; var_dump(get_called_class()); } } } class Test2 extends Test1 { } class Test3 extends Test1 { public static function func() { parent::func(); } } Test1::func(); Test2::func(); Test3::func();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0R5DA
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_STATIC_METHOD_CALL                                  'Test1', 'func'
          1        DO_FCALL                                      0          
   29     2        INIT_STATIC_METHOD_CALL                                  'Test2', 'func'
          3        DO_FCALL                                      0          
   30     4        INIT_STATIC_METHOD_CALL                                  'Test3', 'func'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class Test1:
Function func:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/0R5DA
function name:  func
number of ops:  10
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    8     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->9
   10     4    >   ASSIGN                                                   !0, 1
   11     5        INIT_FCALL                                               'var_dump'
          6        GET_CALLED_CLASS                                 ~4      
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
   13     9    > > RETURN                                                   null

End of function func

End of class Test1.

Class Test2:
Function func:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/0R5DA
function name:  func
number of ops:  10
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    8     1        ISSET_ISEMPTY_CV                                 ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->9
   10     4    >   ASSIGN                                                   !0, 1
   11     5        INIT_FCALL                                               'var_dump'
          6        GET_CALLED_CLASS                                 ~4      
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
   13     9    > > RETURN                                                   null

End of function func

End of class Test2.

Class Test3:
Function func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0R5DA
function name:  func
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  'func'
          1        DO_FCALL                                      0          
   25     2      > RETURN                                                   null

End of function func

End of class Test3.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.87 ms | 1400 KiB | 15 Q