3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public static function describe() { static $description = null; if ($description === null) { $description = "I am a " . get_called_class() . "\n"; } return $description; } } class Animal extends Base { } 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/Qldve
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_STATIC_METHOD_CALL                                  'Cat', 'describe'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   28     3        INIT_STATIC_METHOD_CALL                                  'Dog', 'describe'
          4        DO_FCALL                                      0  $1      
          5        ECHO                                                     $1
   29     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 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/Qldve
function name:  describe
number of ops:  9
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
    7     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
    8     3    >   GET_CALLED_CLASS                                 ~2      
          4        CONCAT                                           ~3      'I+am+a+', ~2
          5        CONCAT                                           ~4      ~3, '%0A'
          6        ASSIGN                                                   !0, ~4
   11     7    > > RETURN                                                   !0
   12     8*     > RETURN                                                   null

End of function describe

End of class Base.

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

End of function describe

End of class Animal.

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

End of function describe

End of class Cat.

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

End of function describe

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199 ms | 1399 KiB | 13 Q