3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Base { public static function describe() { echo "--> " . ($calculated = "I am a " . get_called_class() . "\n"); static $cached = null; if ($cached === null) { $cached = $calculated; } return $cached; } } class Animal extends Base { public static function describe() { return 'Hello! ' . parent::describe(); } } class Cat extends Animal { } class Dog extends Animal { } echo Cat::describe(); echo Dog::describe(); echo Animal::describe();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcrL8
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   INIT_STATIC_METHOD_CALL                                      'Cat', 'describe'
          1        DO_FCALL                                          0  $0      
          2        ECHO                                                         $0
   32     3        INIT_STATIC_METHOD_CALL                                      'Dog', 'describe'
          4        DO_FCALL                                          0  $1      
          5        ECHO                                                         $1
   33     6        INIT_STATIC_METHOD_CALL                                      'Animal', 'describe'
          7        DO_FCALL                                          0  $2      
          8        ECHO                                                         $2
          9      > RETURN                                                       1

Class Base:
Function describe:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/CcrL8
function name:  describe
number of ops:  12
compiled vars:  !0 = $calculated, !1 = $cached
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   GET_CALLED_CLASS                                     ~2      
          1        CONCAT                                               ~3      'I+am+a+', ~2
          2        CONCAT                                               ~4      ~3, '%0A'
          3        ASSIGN                                               ~5      !0, ~4
          4        CONCAT                                               ~6      '--%3E+', ~5
          5        ECHO                                                         ~6
    7     6        BIND_STATIC                                                  !1
    9     7        TYPE_CHECK                                        2          !1
          8      > JMPZ                                                         ~7, ->10
   10     9    >   ASSIGN                                                       !1, !0
   13    10    > > RETURN                                                       !1
   14    11*     > RETURN                                                       null

End of function describe

End of class Base.

Class Animal:
Function describe:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcrL8
function name:  describe
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   INIT_STATIC_METHOD_CALL                                      'describe'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      'Hello%21+', $0
          3      > RETURN                                                       ~1
   20     4*     > RETURN                                                       null

End of function describe

End of class Animal.

Class Cat:
Function describe:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcrL8
function name:  describe
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   INIT_STATIC_METHOD_CALL                                      'describe'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      'Hello%21+', $0
          3      > RETURN                                                       ~1
   20     4*     > RETURN                                                       null

End of function describe

End of class Cat.

Class Dog:
Function describe:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcrL8
function name:  describe
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   INIT_STATIC_METHOD_CALL                                      'describe'
          1        DO_FCALL                                          0  $0      
          2        CONCAT                                               ~1      'Hello%21+', $0
          3      > RETURN                                                       ~1
   20     4*     > RETURN                                                       null

End of function describe

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.63 ms | 3198 KiB | 13 Q