3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface RegularInterface {} interface BetterInterface extends RegularInterface {} class Thing implements BetterInterface { } class RegularClass { public static function doSomething(RegularInterface $thing) { echo 'hello'; } } class BetterClass extends RegularClass { // Attempt to specify a more specific typehint. public static function doSomething(BetterInterface $thing) { echo 'hello'; } } $thing = new Thing(); BetterClass::doSomething($thing);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1C4e
function name:  (null)
number of ops:  10
compiled vars:  !0 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_CLASS                                            'betterinterface'
    6     1        DECLARE_CLASS                                            'thing'
   15     2        DECLARE_CLASS                                            'betterclass', 'regularclass'
   22     3        NEW                                              $1      'Thing'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $1
   23     6        INIT_STATIC_METHOD_CALL                                  'BetterClass', 'doSomething'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Class RegularInterface: [no user functions]
Class BetterInterface: [no user functions]
Class Thing: [no user functions]
Class RegularClass:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1C4e
function name:  doSomething
number of ops:  3
compiled vars:  !0 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ECHO                                                     'hello'
   12     2      > RETURN                                                   null

End of function dosomething

End of class RegularClass.

Class BetterClass:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b1C4e
function name:  doSomething
number of ops:  3
compiled vars:  !0 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        ECHO                                                     'hello'
   19     2      > RETURN                                                   null

End of function dosomething

End of class BetterClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.79 ms | 1385 KiB | 13 Q