3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const HIGH = 0; public function getStatic() { return static::HIGH; } public function getSelf() { return self::HIGH; } } class B extends A { const HIGH = 100; } $a = new A(); $b = new B(); var_dump([ "a" => [ "self" => $a->getSelf(), "static" => $a->getStatic() ], "b" => [ "self" => $b->getSelf(), "static" => $b->getStatic() ] ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgh0d
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   22     3        NEW                                              $5      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   24     6        INIT_FCALL                                               'var_dump'
   26     7        INIT_METHOD_CALL                                         !0, 'getSelf'
          8        DO_FCALL                                      0  $8      
          9        INIT_ARRAY                                       ~9      $8, 'self'
   27    10        INIT_METHOD_CALL                                         !0, 'getStatic'
         11        DO_FCALL                                      0  $10     
         12        ADD_ARRAY_ELEMENT                                ~9      $10, 'static'
         13        INIT_ARRAY                                       ~11     ~9, 'a'
   30    14        INIT_METHOD_CALL                                         !1, 'getSelf'
         15        DO_FCALL                                      0  $12     
         16        INIT_ARRAY                                       ~13     $12, 'self'
   31    17        INIT_METHOD_CALL                                         !1, 'getStatic'
         18        DO_FCALL                                      0  $14     
         19        ADD_ARRAY_ELEMENT                                ~13     $14, 'static'
         20        ADD_ARRAY_ELEMENT                                ~11     ~13, 'b'
         21        SEND_VAL                                                 ~11
         22        DO_ICALL                                                 
   33    23      > RETURN                                                   1

Class A:
Function getstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgh0d
function name:  getStatic
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_CLASS_CONSTANT                             ~0      'HIGH'
          1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function getstatic

Function getself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgh0d
function name:  getSelf
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   0
   14     1*     > RETURN                                                   null

End of function getself

End of class A.

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

End of function getstatic

Function getself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgh0d
function name:  getSelf
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   0
   14     1*     > RETURN                                                   null

End of function getself

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.94 ms | 1400 KiB | 15 Q