3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum Colour: int { case Red = 1; case Blue = 2; case Green = 3; } class Car { public function __construct( private string $id, private Colour $colour, ) {} } class CarStorage { public function add(Car $car): void {} public function get(string $id): ?Car { } } $storage = new CarStorage; $carId = uniqid(); $car = new Car($carId, Colour::Red); var_dump($car); $storage->add($car); // $car = $storage->get($carId);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b028I
function name:  (null)
number of ops:  20
compiled vars:  !0 = $storage, !1 = $carId, !2 = $car
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'colour'
   23     1        NEW                                                  $3      'CarStorage'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
   24     4        INIT_FCALL                                                   'uniqid'
          5        DO_ICALL                                             $6      
          6        ASSIGN                                                       !1, $6
   25     7        NEW                                                  $8      'Car'
          8        SEND_VAR_EX                                                  !1
          9        FETCH_CLASS_CONSTANT                                 ~9      'Colour', 'Red'
         10        SEND_VAL_EX                                                  ~9
         11        DO_FCALL                                          0          
         12        ASSIGN                                                       !2, $8
   26    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                                     
   27    16        INIT_METHOD_CALL                                             !0, 'add'
         17        SEND_VAR_EX                                                  !2
         18        DO_FCALL                                          0          
   28    19      > RETURN                                                       1

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

End of function __construct

End of class Car.

Class CarStorage:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b028I
function name:  add
number of ops:  2
compiled vars:  !0 = $car
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
          1      > RETURN                                                       null

End of function add

Function get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b028I
function name:  get
number of ops:  3
compiled vars:  !0 = $id
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
   20     1        VERIFY_RETURN_TYPE                                           
          2      > RETURN                                                       null

End of function get

End of class CarStorage.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.24 ms | 1098 KiB | 15 Q