3v4l.org

run code in 500+ PHP versions simultaneously
<?php $dates = ['20240228', '20240229', '20240301']; $groups = []; foreach ($dates as $date) { $date = new DateTime($date); $groups[$date->format('F')][] = $date->format('j'); } echo implode( ' & ', array_map( fn($j, $F) => implode(', ', $j) . " $F", $groups, array_keys($groups) ) );
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/Jhnut
function name:  (null)
number of ops:  31
compiled vars:  !0 = $dates, !1 = $groups, !2 = $date
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    5     1        ASSIGN                                                       !1, <array>
    6     2      > FE_RESET_R                                           $5      !0, ->18
          3    > > FE_FETCH_R                                                   $5, !2, ->18
    7     4    >   NEW                                                  $6      'DateTime'
          5        SEND_VAR_EX                                                  !2
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !2, $6
    8     8        INIT_METHOD_CALL                                             !2, 'format'
          9        SEND_VAL_EX                                                  'F'
         10        DO_FCALL                                          0  $9      
         11        INIT_METHOD_CALL                                             !2, 'format'
         12        SEND_VAL_EX                                                  'j'
         13        DO_FCALL                                          0  $12     
         14        FETCH_DIM_W                                          $10     !1, $9
         15        ASSIGN_DIM                                                   $10
         16        OP_DATA                                                      $12
    6    17      > JMP                                                          ->3
         18    >   FE_FREE                                                      $5
   13    19        INIT_FCALL                                                   'array_map'
   14    20        DECLARE_LAMBDA_FUNCTION                              ~13     [0]
         21        SEND_VAL                                                     ~13
   15    22        SEND_VAR                                                     !1
   16    23        INIT_FCALL                                                   'array_keys'
         24        SEND_VAR                                                     !1
         25        DO_ICALL                                             $14     
         26        SEND_VAR                                                     $14
   13    27        DO_ICALL                                             $15     
   11    28        FRAMELESS_ICALL_2                implode             ~16     '+%26+', $15
   16    29        ECHO                                                         ~16
   18    30      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jhnut
function name:  {closure:/in/Jhnut:14}
number of ops:  8
compiled vars:  !0 = $j, !1 = $F
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        FRAMELESS_ICALL_2                implode             ~2      '%2C+', !0
          3        NOP                                                          
          4        FAST_CONCAT                                          ~3      '+', !1
          5        CONCAT                                               ~4      ~2, ~3
          6      > RETURN                                                       ~4
          7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
191.97 ms | 1596 KiB | 16 Q