3v4l.org

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

End of function describe

End of class Dog.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.94 ms | 1399 KiB | 13 Q