3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum WeekDay: string { case Monday = 'monday'; case Tuesday = 'tuesday'; case Wednesday = 'wednesday'; case Thursday = 'thursday'; case Friday = 'friday'; case Saturday = 'saturday'; case Sunday = 'sunday'; } class Foo { public function hello() { return "Hello world" . PHP_EOL; } } $array = []; $array[WeekDay::Monday->value] = new Foo(); // etc echo $array[WeekDay::Monday->value]->hello(); $map = new WeakMap(); $map[WeekDay::Monday] = new Foo(); // etc echo $map[WeekDay::Monday]->hello();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cji28
function name:  (null)
number of ops:  28
compiled vars:  !0 = $array, !1 = $map
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'weekday'
   22     1        ASSIGN                                                       !0, <array>
   23     2        FETCH_CLASS_CONSTANT                                 ~3      'WeekDay', 'Monday'
          3        FETCH_OBJ_R                                          ~4      ~3, 'value'
          4        NEW                                                  $6      'Foo'
          5        DO_FCALL                                          0          
          6        ASSIGN_DIM                                                   !0, ~4
          7        OP_DATA                                                      $6
   26     8        FETCH_CLASS_CONSTANT                                 ~8      'WeekDay', 'Monday'
          9        FETCH_OBJ_R                                          ~9      ~8, 'value'
         10        FETCH_DIM_R                                          ~10     !0, ~9
         11        INIT_METHOD_CALL                                             ~10, 'hello'
         12        DO_FCALL                                          0  $11     
         13        ECHO                                                         $11
   28    14        NEW                                                  $12     'WeakMap'
         15        DO_FCALL                                          0          
         16        ASSIGN                                                       !1, $12
   29    17        FETCH_CLASS_CONSTANT                                 ~15     'WeekDay', 'Monday'
         18        NEW                                                  $17     'Foo'
         19        DO_FCALL                                          0          
         20        ASSIGN_DIM                                                   !1, ~15
         21        OP_DATA                                                      $17
   32    22        FETCH_CLASS_CONSTANT                                 ~19     'WeekDay', 'Monday'
         23        FETCH_DIM_R                                          ~20     !1, ~19
         24        INIT_METHOD_CALL                                             ~20, 'hello'
         25        DO_FCALL                                          0  $21     
         26        ECHO                                                         $21
         27      > RETURN                                                       1

Class WeekDay: [no user functions]
Class Foo:
Function hello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cji28
function name:  hello
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                       'Hello+world%0A'
   19     1*     > RETURN                                                       null

End of function hello

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.12 ms | 1483 KiB | 13 Q