3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum Department { case SPORTING; case HOME; case ELECTRONICS; case APPAREL; } class Product { public function __construct(public string $type, public Department $department) { } } $sporting = new Product('Ball', Department::SPORTING); var_dump($sporting);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Dljv
function name:  (null)
number of ops:  11
compiled vars:  !0 = $sporting
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'department'
   18     1        NEW                                              $1      'Product'
          2        SEND_VAL_EX                                              'Ball'
          3        FETCH_CLASS_CONSTANT                             ~2      'Department', 'SPORTING'
          4        SEND_VAL_EX                                              ~2
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $1
   19     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

End of function __construct

End of class Product.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.26 ms | 1009 KiB | 14 Q