3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentItem { } class ChildItem extends ParentItem { } class ParentManager { function do_something(ParentItem $item) { } } class ChildManager extends ParentManager { // this is the problem. how do i explain to php that // ChildItem *is* a ParentItem function do_something(ParentItem $item) { } } (new ChildManager())->do_something(new ChildItem);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qVYWZ
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $0      'ChildManager'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'do_something'
          3        NEW                                              $2      'ChildItem'
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $2
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class ParentItem: [no user functions]
Class ChildItem: [no user functions]
Class ParentManager:
Function do_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qVYWZ
function name:  do_something
number of ops:  2
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1      > RETURN                                                   null

End of function do_something

End of class ParentManager.

Class ChildManager:
Function do_something:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qVYWZ
function name:  do_something
number of ops:  2
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1      > RETURN                                                   null

End of function do_something

End of class ChildManager.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.85 ms | 1398 KiB | 13 Q