3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PoweredVehicle { protected $odometer = 0; protected $vehicle_type; protected $colour; public function __construct($vehicle_type, $colour) { $this->vehicle_type = $vehicle_type; $this->colour = $colour; } } $car = new PoweredVehicle('car', 'blue'); $go_back_in_time = function () : PoweredVehicle { $this->vehicle_type = 'horse'; $this->colour = 'brown'; return $this; }; $horse = $go_back_in_time->call($car); var_dump($horse);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VIlXL
function name:  (null)
number of ops:  15
compiled vars:  !0 = $car, !1 = $go_back_in_time, !2 = $horse
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $3      'PoweredVehicle'
          1        SEND_VAL_EX                                              'car'
          2        SEND_VAL_EX                                              'blue'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   18     5        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          6        ASSIGN                                                   !1, ~6
   24     7        INIT_METHOD_CALL                                         !1, 'call'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $8      
         10        ASSIGN                                                   !2, $8
   26    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VIlXL
function name:  {closure}
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ                                               $0, 'vehicle_type'
          2        OP_DATA                                                  'horse'
   20     3        FETCH_THIS                                       $2      
          4        ASSIGN_OBJ                                               $2, 'colour'
          5        OP_DATA                                                  'brown'
   21     6        FETCH_THIS                                       ~4      
          7        VERIFY_RETURN_TYPE                                       ~4
          8      > RETURN                                                   ~4
   22     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of Dynamic Function 0

Class PoweredVehicle:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VIlXL
function name:  __construct
number of ops:  7
compiled vars:  !0 = $vehicle_type, !1 = $colour
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ASSIGN_OBJ                                               'vehicle_type'
          3        OP_DATA                                                  !0
   11     4        ASSIGN_OBJ                                               'colour'
          5        OP_DATA                                                  !1
   12     6      > RETURN                                                   null

End of function __construct

End of class PoweredVehicle.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.99 ms | 1003 KiB | 14 Q