3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Car { protected $speed = 0; protected $people = 0; public function onboardPerson() { $this->people++; } public function accelerate() { $this->speed++; } } class Taxi extends Car { protected $fare; public function setFare($fare) { $this->fare = $fare; } } $taxi = new Taxi(); // Replace instances of type Car (T) with subtype Taxi (S) $taxi->onboardPerson(); $taxi->accelerate(); var_dump($taxi);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtBYI
function name:  (null)
number of ops:  11
compiled vars:  !0 = $taxi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'Taxi'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'onboardPerson'
          4        DO_FCALL                                      0          
   23     5        INIT_METHOD_CALL                                         !0, 'accelerate'
          6        DO_FCALL                                      0          
   25     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class Car:
Function onboardperson:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtBYI
function name:  onboardPerson
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   PRE_INC_OBJ                                              'people'
    8     1      > RETURN                                                   null

End of function onboardperson

Function accelerate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtBYI
function name:  accelerate
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   PRE_INC_OBJ                                              'speed'
   11     1      > RETURN                                                   null

End of function accelerate

End of class Car.

Class Taxi:
Function setfare:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtBYI
function name:  setFare
number of ops:  4
compiled vars:  !0 = $fare
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ASSIGN_OBJ                                               'fare'
          2        OP_DATA                                                  !0
   17     3      > RETURN                                                   null

End of function setfare

Function onboardperson:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtBYI
function name:  onboardPerson
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   PRE_INC_OBJ                                              'people'
    8     1      > RETURN                                                   null

End of function onboardperson

Function accelerate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RtBYI
function name:  accelerate
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   PRE_INC_OBJ                                              'speed'
   11     1      > RETURN                                                   null

End of function accelerate

End of class Taxi.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.24 ms | 1400 KiB | 15 Q