3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( '2021-08-31' => array( 'country_id' => array( '191' => array( '20098' ) ) ), '2021-08-18' => array( 'country_id' => array( '214' => array( '14876' ) ) ), '2021-07-12' => array( 'country_id' => array( '103' => array( '19709' ) ) ), '2021-07-07' => array( 'country_id' => array( '206' => array( '9568' ) ) ), '2021-06-28' => array( 'country_id' => array( '246' => array( '19561' ), '132' => array( '19277' ), '1' => array( '2816' ), '83' => array( '19530' ), '21' => array('3340'), '202' => array( '14136' ), '103' => array( '17006' ) ) ), '2021-06-25' => array( 'country_id' => array( '99' => array( '14561' ), '102' => array( '26789' ), '21' => array( '7690' ), '210' => array( '242325' ), '11' => array('436432'), '999' => array( '43734' ), '768' => array( '34437' ) ) ),); // set your slice with start and end $start = 3; $end = 9; $count = 0; $store = []; // the result store foreach($data as $date => $record) { foreach($record['country_id'] as $k => $countryIds) { foreach($countryIds as $id) { $count++; if($count >= $start && $count <= $end) $store[$date]['country_id'][$k] = $countryIds; } } } print_r($store);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 29
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 27
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 27
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 25
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 25
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 24
Branch analysis from position: 19
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 25
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 27
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/fgorg
function name:  (null)
number of ops:  34
compiled vars:  !0 = $data, !1 = $start, !2 = $end, !3 = $count, !4 = $store, !5 = $record, !6 = $date, !7 = $countryIds, !8 = $k, !9 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, 3
   12     2        ASSIGN                                                   !2, 9
   14     3        ASSIGN                                                   !3, 0
   15     4        ASSIGN                                                   !4, <array>
   16     5      > FE_RESET_R                                       $15     !0, ->29
          6    > > FE_FETCH_R                                       ~16     $15, !5, ->29
          7    >   ASSIGN                                                   !6, ~16
   17     8        FETCH_DIM_R                                      ~18     !5, 'country_id'
          9      > FE_RESET_R                                       $19     ~18, ->27
         10    > > FE_FETCH_R                                       ~20     $19, !7, ->27
         11    >   ASSIGN                                                   !8, ~20
   18    12      > FE_RESET_R                                       $22     !7, ->25
         13    > > FE_FETCH_R                                               $22, !9, ->25
   19    14    >   PRE_INC                                                  !3
   20    15        IS_SMALLER_OR_EQUAL                              ~24     !1, !3
         16      > JMPZ_EX                                          ~24     ~24, ->19
         17    >   IS_SMALLER_OR_EQUAL                              ~25     !3, !2
         18        BOOL                                             ~24     ~25
         19    > > JMPZ                                                     ~24, ->24
         20    >   FETCH_DIM_W                                      $26     !4, !6
         21        FETCH_DIM_W                                      $27     $26, 'country_id'
         22        ASSIGN_DIM                                               $27, !8
         23        OP_DATA                                                  !7
   18    24    > > JMP                                                      ->13
         25    >   FE_FREE                                                  $22
   17    26      > JMP                                                      ->10
         27    >   FE_FREE                                                  $19
   16    28      > JMP                                                      ->6
         29    >   FE_FREE                                                  $15
   25    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !4
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.14 ms | 1400 KiB | 15 Q