3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface I { public function example($a, $b, $c); } class A implements I { public function example($a, $b = null, $c = null) { } // compatible with I::example } class B extends A { public function example($a, $b, $c = null) { } // compatible with I::example } function accepts_i(I $i) { $i->example(1, 2, 3); } accepts_i(new B); // no problem function accepts_a(A $a) { $a->example(1); } accepts_a(new B); // problem
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OneV3
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'a'
    9     1        DECLARE_CLASS                                            'b', 'a'
   16     2        INIT_FCALL                                               'accepts_i'
          3        NEW                                              $0      'B'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0          
   21     7        INIT_FCALL                                               'accepts_a'
          8        NEW                                              $3      'B'
          9        DO_FCALL                                      0          
         10        SEND_VAR                                                 $3
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function accepts_i:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OneV3
function name:  accepts_i
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_METHOD_CALL                                         !0, 'example'
          2        SEND_VAL_EX                                              1
          3        SEND_VAL_EX                                              2
          4        SEND_VAL_EX                                              3
          5        DO_FCALL                                      0          
   15     6      > RETURN                                                   null

End of function accepts_i

Function accepts_a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OneV3
function name:  accepts_a
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        INIT_METHOD_CALL                                         !0, 'example'
          2        SEND_VAL_EX                                              1
          3        DO_FCALL                                      0          
   20     4      > RETURN                                                   null

End of function accepts_a

Class I:
Function example:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OneV3
function name:  example
number of ops:  4
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3      > RETURN                                                   null

End of function example

End of class I.

Class A:
Function example:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OneV3
function name:  example
number of ops:  4
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
          3      > RETURN                                                   null

End of function example

End of class A.

Class B:
Function example:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OneV3
function name:  example
number of ops:  4
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      null
          3      > RETURN                                                   null

End of function example

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.33 ms | 1403 KiB | 15 Q