3v4l.org

run code in 300+ PHP versions simultaneously
<?php $description = null; class Base { public static function describe() { global $description; if ($description === null) { $description = "I am a " . get_called_class() . "\n"; } return $description; } } class Animal extends Base { } class Cat extends Animal { public static function describe() { return 'Miauw! ' . parent::describe(); } } 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/0RlHh
function name:  (null)
number of ops:  11
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, null
   31     1        INIT_STATIC_METHOD_CALL                                  'Cat', 'describe'
          2        DO_FCALL                                      0  $2      
          3        ECHO                                                     $2
   32     4        INIT_STATIC_METHOD_CALL                                  'Dog', 'describe'
          5        DO_FCALL                                      0  $3      
          6        ECHO                                                     $3
   33     7        INIT_STATIC_METHOD_CALL                                  'Animal', 'describe'
          8        DO_FCALL                                      0  $4      
          9        ECHO                                                     $4
         10      > 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/0RlHh
function name:  describe
number of ops:  9
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'description'
    9     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
   10     3    >   GET_CALLED_CLASS                                 ~2      
          4        CONCAT                                           ~3      'I+am+a+', ~2
          5        CONCAT                                           ~4      ~3, '%0A'
          6        ASSIGN                                                   !0, ~4
   13     7    > > RETURN                                                   !0
   14     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/0RlHh
function name:  describe
number of ops:  9
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'description'
    9     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
   10     3    >   GET_CALLED_CLASS                                 ~2      
          4        CONCAT                                           ~3      'I+am+a+', ~2
          5        CONCAT                                           ~4      ~3, '%0A'
          6        ASSIGN                                                   !0, ~4
   13     7    > > RETURN                                                   !0
   14     8*     > 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/0RlHh
function name:  describe
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'describe'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      'Miauw%21+', $0
          3      > RETURN                                                   ~1
   24     4*     > 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/0RlHh
function name:  describe
number of ops:  9
compiled vars:  !0 = $description
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_GLOBAL                                              !0, 'description'
    9     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
   10     3    >   GET_CALLED_CLASS                                 ~2      
          4        CONCAT                                           ~3      'I+am+a+', ~2
          5        CONCAT                                           ~4      ~3, '%0A'
          6        ASSIGN                                                   !0, ~4
   13     7    > > RETURN                                                   !0
   14     8*     > RETURN                                                   null

End of function describe

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.25 ms | 1399 KiB | 13 Q