3v4l.org

run code in 300+ PHP versions simultaneously
<?php $exhibitions = [ [ 'exhibition_title' => 'Picasso', 'venue_name' => 'Gallery 1', 'room_name' => 'Room 4', 'start_date' => '2023-11-15', 'end_date' => '2023-11-17', 'room_id' => 261, 'exhibition_id' => 3540, 'venue_order' => 2, ], [ 'exhibition_title' => 'Monet', 'venue_name' => 'Gallery 4', 'room_name' => 'Room 2', 'start_date' => '2023-10-30', 'end_date' => '2023-11-03', 'room_id' => 274, 'exhibition_id' => 8417, 'venue_order' => 1, ] ]; $result = []; foreach ($exhibitions as $row) { $dateObjects = new DatePeriod( new DateTime($row['start_date']), new DateInterval('P1D'), new DateTime("{$row['end_date']} +1 day") ); foreach ($dateObjects as $d) { $result[] = $row + ['date' => $d->format("Y-m-d")]; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 36
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 36
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 34
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 34
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 34
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/2IQhp
function name:  (null)
number of ops:  41
compiled vars:  !0 = $exhibitions, !1 = $result, !2 = $row, !3 = $dateObjects, !4 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        ASSIGN                                                   !1, <array>
   27     2      > FE_RESET_R                                       $7      !0, ->36
          3    > > FE_FETCH_R                                               $7, !2, ->36
   28     4    >   NEW                                              $8      'DatePeriod'
   29     5        NEW                                              $9      'DateTime'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_DIM_FUNC_ARG                               $10     !2, 'start_date'
          8        SEND_FUNC_ARG                                            $10
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $9
   30    11        NEW                                              $12     'DateInterval'
         12        SEND_VAL_EX                                              'P1D'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $12
   31    15        NEW                                              $14     'DateTime'
         16        FETCH_DIM_R                                      ~15     !2, 'end_date'
         17        NOP                                                      
         18        FAST_CONCAT                                      ~16     ~15, '+%2B1+day'
         19        SEND_VAL_EX                                              ~16
         20        DO_FCALL                                      0          
         21        SEND_VAR_NO_REF_EX                                       $14
   28    22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $8
   33    24      > FE_RESET_R                                       $20     !3, ->34
         25    > > FE_FETCH_R                                               $20, !4, ->34
   34    26    >   INIT_METHOD_CALL                                         !4, 'format'
         27        SEND_VAL_EX                                              'Y-m-d'
         28        DO_FCALL                                      0  $22     
         29        INIT_ARRAY                                       ~23     $22, 'date'
         30        ADD                                              ~24     !2, ~23
         31        ASSIGN_DIM                                               !1
         32        OP_DATA                                                  ~24
   33    33      > JMP                                                      ->25
         34    >   FE_FREE                                                  $20
   27    35      > JMP                                                      ->3
         36    >   FE_FREE                                                  $7
   37    37        INIT_FCALL                                               'var_export'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.53 ms | 1005 KiB | 14 Q