3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newArr = array ( 100 => array ( 1 => array ( 'AVA_Date' => '2019-04-18', 'ROO_Id' => 100, 'RAT_Id' => 9 ), 2 => array ( 'AVA_Date' => '2019-04-20', 'ROO_Id' => 100, 'RAT_Id' => 10 ), 4 => array ( 'AVA_Date' => '2019-04-21', 'ROO_Id' => 100, 'RAT_Id' => 10 ), 7 => array ( 'AVA_Date' => '2019-04-22', 'ROO_Id' => 100, 'RAT_Id' => 9 ) ) ); $result = []; foreach ($newArr as $rooId => $rows) { $groups = []; foreach ($rows as $row) { if (!isset($groups[$row['RAT_Id']])) { $row['AVA_Date'] = (array) $row['AVA_Date']; $groups[$row['RAT_Id']] = $row; } else { $groups[$row['RAT_Id']]['AVA_Date'][] = $row['AVA_Date']; } } $result[$rooId] = array_values($groups); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 34
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 34
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 27
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 27
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/c1VBX
function name:  (null)
number of ops:  39
compiled vars:  !0 = $newArr, !1 = $result, !2 = $rows, !3 = $rooId, !4 = $groups, !5 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   32     1        ASSIGN                                                   !1, <array>
   33     2      > FE_RESET_R                                       $8      !0, ->34
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->34
          4    >   ASSIGN                                                   !3, ~9
   34     5        ASSIGN                                                   !4, <array>
   35     6      > FE_RESET_R                                       $12     !2, ->27
          7    > > FE_FETCH_R                                               $12, !5, ->27
   36     8    >   FETCH_DIM_R                                      ~13     !5, 'RAT_Id'
          9        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !4, ~13
         10        BOOL_NOT                                         ~15     ~14
         11      > JMPZ                                                     ~15, ->20
   37    12    >   FETCH_DIM_R                                      ~17     !5, 'AVA_Date'
         13        CAST                                          7  ~18     ~17
         14        ASSIGN_DIM                                               !5, 'AVA_Date'
         15        OP_DATA                                                  ~18
   38    16        FETCH_DIM_R                                      ~19     !5, 'RAT_Id'
         17        ASSIGN_DIM                                               !4, ~19
         18        OP_DATA                                                  !5
         19      > JMP                                                      ->26
   40    20    >   FETCH_DIM_R                                      ~21     !5, 'RAT_Id'
         21        FETCH_DIM_R                                      ~25     !5, 'AVA_Date'
         22        FETCH_DIM_W                                      $22     !4, ~21
         23        FETCH_DIM_W                                      $23     $22, 'AVA_Date'
         24        ASSIGN_DIM                                               $23
         25        OP_DATA                                                  ~25
   35    26    > > JMP                                                      ->7
         27    >   FE_FREE                                                  $12
   43    28        INIT_FCALL                                               'array_values'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $27     
         31        ASSIGN_DIM                                               !1, !3
         32        OP_DATA                                                  $27
   33    33      > JMP                                                      ->3
         34    >   FE_FREE                                                  $8
   45    35        INIT_FCALL                                               'var_export'
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.31 ms | 1413 KiB | 17 Q