3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Beer { const NAME = 'Beer!'; public function getName() { return self::NAME; } public function getStaticName() { return static::NAME; } } class Ale extends Beer { const NAME = 'Ale!'; } $beerDrink = new Beer; $aleDrink = new Ale; echo "Beer is: " . $beerDrink->getName() ."\n"; echo "Ale is: " . $aleDrink->getName() ."\n"; echo "Beer is actually: " . $beerDrink->getStaticName() ."\n"; echo "Ale is actually: " . $aleDrink->getStaticName() ."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TclEs
function name:  (null)
number of ops:  27
compiled vars:  !0 = $beerDrink, !1 = $aleDrink
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'Beer'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   22     3        NEW                                              $5      'Ale'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   24     6        INIT_METHOD_CALL                                         !0, 'getName'
          7        DO_FCALL                                      0  $8      
          8        CONCAT                                           ~9      'Beer+is%3A+', $8
          9        CONCAT                                           ~10     ~9, '%0A'
         10        ECHO                                                     ~10
   25    11        INIT_METHOD_CALL                                         !1, 'getName'
         12        DO_FCALL                                      0  $11     
         13        CONCAT                                           ~12     'Ale+is%3A++', $11
         14        CONCAT                                           ~13     ~12, '%0A'
         15        ECHO                                                     ~13
   26    16        INIT_METHOD_CALL                                         !0, 'getStaticName'
         17        DO_FCALL                                      0  $14     
         18        CONCAT                                           ~15     'Beer+is+actually%3A+', $14
         19        CONCAT                                           ~16     ~15, '%0A'
         20        ECHO                                                     ~16
   27    21        INIT_METHOD_CALL                                         !1, 'getStaticName'
         22        DO_FCALL                                      0  $17     
         23        CONCAT                                           ~18     'Ale+is+actually%3A++', $17
         24        CONCAT                                           ~19     ~18, '%0A'
         25        ECHO                                                     ~19
         26      > RETURN                                                   1

Class Beer:
Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TclEs
function name:  getName
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   'Beer%21'
    9     1*     > RETURN                                                   null

End of function getname

Function getstaticname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TclEs
function name:  getStaticName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_CLASS_CONSTANT                             ~0      'NAME'
          1      > RETURN                                                   ~0
   13     2*     > RETURN                                                   null

End of function getstaticname

End of class Beer.

Class Ale:
Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TclEs
function name:  getName
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E > > RETURN                                                   'Beer%21'
    9     1*     > RETURN                                                   null

End of function getname

Function getstaticname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TclEs
function name:  getStaticName
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_CLASS_CONSTANT                             ~0      'NAME'
          1      > RETURN                                                   ~0
   13     2*     > RETURN                                                   null

End of function getstaticname

End of class Ale.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.62 ms | 1453 KiB | 13 Q