3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ia { const c = 'Sea'; } class Foo implements ia { const c = "Lake"; // Attempting to override ia's constant c in // this class triggers a fatal error. } class FooBar extends Foo implements ia { const c = 'Ocean'; // No error, class constant // overriding ia's definition. public function show(){ // ia's definition is still accessible. return ia::c; } public function showp(){ return parent::c; } } $i = new FooBar; echo FooBar::c; echo $i->show(); echo $i->showp();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4rAaE
function name:  (null)
number of ops:  14
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'foo'
   17     1        DECLARE_CLASS                                            'foobar', 'foo'
   32     2        NEW                                              $1      'FooBar'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   33     5        FETCH_CLASS_CONSTANT                             ~4      'FooBar', 'c'
          6        ECHO                                                     ~4
   34     7        INIT_METHOD_CALL                                         !0, 'show'
          8        DO_FCALL                                      0  $5      
          9        ECHO                                                     $5
   35    10        INIT_METHOD_CALL                                         !0, 'showp'
         11        DO_FCALL                                      0  $6      
         12        ECHO                                                     $6
         13      > RETURN                                                   1

Class ia: [no user functions]
Class Foo: [no user functions]
Class FooBar:
Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4rAaE
function name:  show
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > RETURN                                                   'Sea'
   25     1*     > RETURN                                                   null

End of function show

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

End of function showp

End of class FooBar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.67 ms | 1394 KiB | 13 Q