3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $x = 10; public function myMethod($x=0) { return $this->x; } } class B extends A { public function myMethod($x=0) { return 2 * $this->x; } } $m = new B(5); echo $m->myMethod();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kv37A
function name:  (null)
number of ops:  8
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'B'
          1        SEND_VAL_EX                                              5
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   20     4        INIT_METHOD_CALL                                         !0, 'myMethod'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

Class A:
Function mymethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kv37A
function name:  myMethod
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      0
    7     1        FETCH_OBJ_R                                      ~1      'x'
          2      > RETURN                                                   ~1
    8     3*     > RETURN                                                   null

End of function mymethod

End of class A.

Class B:
Function mymethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kv37A
function name:  myMethod
number of ops:  5
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV_INIT                                        !0      0
   15     1        FETCH_OBJ_R                                      ~1      'x'
          2        MUL                                              ~2      ~1, 2
          3      > RETURN                                                   ~2
   16     4*     > RETURN                                                   null

End of function mymethod

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.99 ms | 1394 KiB | 13 Q