3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types = 1); class Engine { public function rev(): void { echo "Reving normal\n"; } } class SportEngine extends Engine { public function revHigh(): void { echo "Reving to the red line!\n"; } } class Car { protected Engine $engine; public function __construct(Engine $engine) { $this->engine = $engine; } public function getEngine(): Engine { return $this->engine; } } class SportsCar extends Car { public function __construct(SportEngine $engine) { $this->engine = $engine; } public function getSportEngine(): SportEngine { return $this->engine; } } $normalCar = new Car(new Engine); $sportScar = new SportsCar(new SportEngine()); $normalCar->getEngine()->rev(); $sportScar->getEngine()->rev(); $sportScar->getSportEngine()->revHigh();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  (null)
number of ops:  25
compiled vars:  !0 = $normalCar, !1 = $sportScar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   49     0  E >   NEW                                                  $2      'Car'
          1        NEW                                                  $3      'Engine'
          2        DO_FCALL                                          0          
          3        SEND_VAR_NO_REF_EX                                           $3
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !0, $2
   50     6        NEW                                                  $7      'SportsCar'
          7        NEW                                                  $8      'SportEngine'
          8        DO_FCALL                                          0          
          9        SEND_VAR_NO_REF_EX                                           $8
         10        DO_FCALL                                          0          
         11        ASSIGN                                                       !1, $7
   52    12        INIT_METHOD_CALL                                             !0, 'getEngine'
         13        DO_FCALL                                          0  $12     
         14        INIT_METHOD_CALL                                             $12, 'rev'
         15        DO_FCALL                                          0          
   53    16        INIT_METHOD_CALL                                             !1, 'getEngine'
         17        DO_FCALL                                          0  $14     
         18        INIT_METHOD_CALL                                             $14, 'rev'
         19        DO_FCALL                                          0          
   54    20        INIT_METHOD_CALL                                             !1, 'getSportEngine'
         21        DO_FCALL                                          0  $16     
         22        INIT_METHOD_CALL                                             $16, 'revHigh'
         23        DO_FCALL                                          0          
         24      > RETURN                                                       1

Class Engine:
Function rev:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  rev
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                         'Reving+normal%0A'
   10     1      > RETURN                                                       null

End of function rev

End of class Engine.

Class SportEngine:
Function revhigh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  revHigh
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   ECHO                                                         'Reving+to+the+red+line%21%0A'
   18     1      > RETURN                                                       null

End of function revhigh

Function rev:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  rev
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                         'Reving+normal%0A'
   10     1      > RETURN                                                       null

End of function rev

End of class SportEngine.

Class Car:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $engine
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   RECV                                                 !0      
   27     1        ASSIGN_OBJ                                                   'engine'
          2        OP_DATA                                                      !0
   28     3      > RETURN                                                       null

End of function __construct

Function getengine:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  getEngine
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                          ~0      'engine'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   33     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getengine

End of class Car.

Class SportsCar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  __construct
number of ops:  4
compiled vars:  !0 = $engine
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   38     0  E >   RECV                                                 !0      
   40     1        ASSIGN_OBJ                                                   'engine'
          2        OP_DATA                                                      !0
   41     3      > RETURN                                                       null

End of function __construct

Function getsportengine:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  getSportEngine
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   45     0  E >   FETCH_OBJ_R                                          ~0      'engine'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   46     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getsportengine

Function getengine:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JaKHJ
function name:  getEngine
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   32     0  E >   FETCH_OBJ_R                                          ~0      'engine'
          1        VERIFY_RETURN_TYPE                                           ~0
          2      > RETURN                                                       ~0
   33     3*       VERIFY_RETURN_TYPE                                           
          4*     > RETURN                                                       null

End of function getengine

End of class SportsCar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.53 ms | 1201 KiB | 13 Q