3v4l.org

run code in 300+ PHP versions simultaneously
<?php enum Fruits: string { case APPLE = 'apple'; case PINEAPPLE = 'pineapple'; case PLUM = 'plum'; public static function choices(): array { return array_map(fn ($case) => $case->value, static::cases()); } } var_dump(Fruits::cases()); var_dump(Fruits::choices());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbcDT
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'fruits'
   12     1        INIT_FCALL                                               'var_dump'
          2        INIT_STATIC_METHOD_CALL                                  'Fruits', 'cases'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   13     6        INIT_FCALL                                               'var_dump'
          7        INIT_STATIC_METHOD_CALL                                  'Fruits', 'choices'
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Fruits:
Function choices:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbcDT
function name:  choices
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'array_map'
          1        DECLARE_LAMBDA_FUNCTION                          ~0      [0]
          2        SEND_VAL                                                 ~0
          3        INIT_STATIC_METHOD_CALL                                  'cases'
          4        DO_FCALL                                      0  $1      
          5        SEND_VAR                                                 $1
          6        DO_ICALL                                         $2      
          7        VERIFY_RETURN_TYPE                                       $2
          8      > RETURN                                                   $2
    9     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbcDT
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $case
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        FETCH_OBJ_R                                      ~1      !0, 'value'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 0

End of function choices

End of class Fruits.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.37 ms | 1002 KiB | 15 Q