3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function getStatic() { return get_class(new static); } public function getCalledClass() { return get_called_class(); } public static function sGetStatic() { return get_class(new static); } public static function sGetCalledClass() { return get_called_class(); } } class B extends A { public function pGetStatic() { return parent::getStatic(); } public function pGetCalledClass() { return parent::getCalledClass(); } public static function psGetStatic() { return parent::sGetStatic(); } public static function psGetCalledClass() { return parent::sGetCalledClass(); } } $b = new B; var_dump($b->getStatic()); $b = new B; var_dump($b->getCalledClass()); var_dump(B::sGetStatic()); var_dump(B::sGetCalledClass()); $b = new B; var_dump($b->pGetStatic()); $b = new B; var_dump($b->pGetCalledClass()); var_dump(B::psGetStatic()); var_dump(B::psGetCalledClass());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  (null)
number of ops:  53
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getStatic'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   15     8        NEW                                              $6      'B'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $6
         11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'getCalledClass'
         13        DO_FCALL                                      0  $9      
         14        SEND_VAR                                                 $9
         15        DO_ICALL                                                 
   16    16        INIT_FCALL                                               'var_dump'
         17        INIT_STATIC_METHOD_CALL                                  'B', 'sGetStatic'
         18        DO_FCALL                                      0  $11     
         19        SEND_VAR                                                 $11
         20        DO_ICALL                                                 
   17    21        INIT_FCALL                                               'var_dump'
         22        INIT_STATIC_METHOD_CALL                                  'B', 'sGetCalledClass'
         23        DO_FCALL                                      0  $13     
         24        SEND_VAR                                                 $13
         25        DO_ICALL                                                 
   18    26        NEW                                              $15     'B'
         27        DO_FCALL                                      0          
         28        ASSIGN                                                   !0, $15
         29        INIT_FCALL                                               'var_dump'
         30        INIT_METHOD_CALL                                         !0, 'pGetStatic'
         31        DO_FCALL                                      0  $18     
         32        SEND_VAR                                                 $18
         33        DO_ICALL                                                 
   19    34        NEW                                              $20     'B'
         35        DO_FCALL                                      0          
         36        ASSIGN                                                   !0, $20
         37        INIT_FCALL                                               'var_dump'
         38        INIT_METHOD_CALL                                         !0, 'pGetCalledClass'
         39        DO_FCALL                                      0  $23     
         40        SEND_VAR                                                 $23
         41        DO_ICALL                                                 
   20    42        INIT_FCALL                                               'var_dump'
         43        INIT_STATIC_METHOD_CALL                                  'B', 'psGetStatic'
         44        DO_FCALL                                      0  $25     
         45        SEND_VAR                                                 $25
         46        DO_ICALL                                                 
   21    47        INIT_FCALL                                               'var_dump'
         48        INIT_STATIC_METHOD_CALL                                  'B', 'psGetCalledClass'
         49        DO_FCALL                                      0  $27     
         50        SEND_VAR                                                 $27
         51        DO_ICALL                                                 
         52      > RETURN                                                   1

Class A:
Function getstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  getStatic
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2        GET_CLASS                                        ~2      $0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function getstatic

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

End of function getcalledclass

Function sgetstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  sGetStatic
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2        GET_CLASS                                        ~2      $0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function sgetstatic

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

End of function sgetcalledclass

End of class A.

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

End of function pgetstatic

Function pgetcalledclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  pGetCalledClass
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                  'getCalledClass'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
          3*     > RETURN                                                   null

End of function pgetcalledclass

Function psgetstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  psGetStatic
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_STATIC_METHOD_CALL                                  'sGetStatic'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
          3*     > RETURN                                                   null

End of function psgetstatic

Function psgetcalledclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  psGetCalledClass
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_STATIC_METHOD_CALL                                  'sGetCalledClass'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
          3*     > RETURN                                                   null

End of function psgetcalledclass

Function getstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  getStatic
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2        GET_CLASS                                        ~2      $0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function getstatic

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

End of function getcalledclass

Function sgetstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BDhja
function name:  sGetStatic
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2        GET_CLASS                                        ~2      $0
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function sgetstatic

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

End of function sgetcalledclass

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.53 ms | 1408 KiB | 15 Q