3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClassWithToStringMixedReturn { public function __toString() { return 'a'; } } class WithParentMixedReturn extends ParentClassWithToStringMixedReturn { public function __toString(): string { return 'value'; } } class Consumer extends WithParentMixedReturn { public function __toString() { return 'value'; } } echo (new Consumer());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kdcEh
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'parentclasswithtostringmixedreturn'
   11     1        DECLARE_CLASS                                            'withparentmixedreturn', 'parentclasswithtostringmixedreturn'
   19     2        DECLARE_CLASS                                            'consumer', 'withparentmixedreturn'
   27     3        NEW                                              $0      'Consumer'
          4        DO_FCALL                                      0          
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Class ParentClassWithToStringMixedReturn:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kdcEh
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   'a'
    8     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class ParentClassWithToStringMixedReturn.

Class WithParentMixedReturn:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kdcEh
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   'value'
   16     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class WithParentMixedReturn.

Class Consumer:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kdcEh
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E > > RETURN                                                   'value'
   24     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class Consumer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.77 ms | 1008 KiB | 13 Q