3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum Colour { case Red; case Blue; case Green; } readonly class Car { public function __construct(private string $hexColour) {} } class CreateCar { public function __invoke(Colour $colour): Car { $carHexColour = match ($colour) { Colour::Red => '#ff5500', Colour::Green => '#4dff00', Colour::Blue => '#0084ff', }; return new Car($carHexColour); } } var_dump((new CreateCar)(Colour::Red));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ibrZL
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'colour'
   25     1        INIT_FCALL                                                   'var_dump'
          2        NEW                                                  $0      'CreateCar'
          3        DO_FCALL                                          0          
          4        INIT_DYNAMIC_CALL                                            $0
          5        FETCH_CLASS_CONSTANT                                 ~2      'Colour', 'Red'
          6        SEND_VAL_EX                                                  ~2
          7        DO_FCALL                                          0  $3      
          8        SEND_VAR                                                     $3
          9        DO_ICALL                                                     
         10      > 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/ibrZL
function name:  __construct
number of ops:  4
compiled vars:  !0 = $hexColour
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
          1        ASSIGN_OBJ                                                   'hexColour'
          2        OP_DATA                                                      !0
          3      > RETURN                                                       null

End of function __construct

End of class Car.

Class CreateCar:
Function __invoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 197) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
filename:       /in/ibrZL
function name:  __invoke
number of ops:  26
compiled vars:  !0 = $colour, !1 = $carHexColour
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   16     1        FETCH_CLASS_CONSTANT                                 ~3      'Colour', 'Red'
          2        IS_IDENTICAL                                                 !0, ~3
          3      > JMPNZ                                                        ~2, ->12
   17     4    >   FETCH_CLASS_CONSTANT                                 ~4      'Colour', 'Green'
          5        IS_IDENTICAL                                                 !0, ~4
          6      > JMPNZ                                                        ~2, ->14
   18     7    >   FETCH_CLASS_CONSTANT                                 ~5      'Colour', 'Blue'
          8        IS_IDENTICAL                                                 !0, ~5
          9      > JMPNZ                                                        ~2, ->16
         10    > > JMP                                                          ->11
         11    > > MATCH_ERROR                                                  !0
   16    12    >   QM_ASSIGN                                            ~6      '%23ff5500'
         13      > JMP                                                          ->18
   17    14    >   QM_ASSIGN                                            ~6      '%234dff00'
         15      > JMP                                                          ->18
   18    16    >   QM_ASSIGN                                            ~6      '%230084ff'
         17      > JMP                                                          ->18
   15    18    >   ASSIGN                                                       !1, ~6
   21    19        NEW                                                  $8      'Car'
         20        SEND_VAR_EX                                                  !1
         21        DO_FCALL                                          0          
         22        VERIFY_RETURN_TYPE                                           $8
         23      > RETURN                                                       $8
   22    24*       VERIFY_RETURN_TYPE                                           
         25*     > RETURN                                                       null

End of function __invoke

End of class CreateCar.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.01 ms | 1352 KiB | 14 Q