3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sorted = [ [ ['Year' => "2020", 'Month' => "Feb", 'Analyzed' => 23, 'Account' => 225,], ['Year' => "2021", 'Month' => "Feb", 'Analyzed' => 23, 'Account' => 125,], ['Year' => "2022", 'Month' => "Feb", 'Analyzed' => 23, 'Account' => 425,], ], [ ['Year' => "2020", 'Month' => "Feb", 'Analyzed' => 23, 'Account' => 55,], ['Year' => "2021", 'Month' => "Feb", 'Analyzed' => 23, 'Account' => 33,], ['Year' => "2022", 'Month' => "Feb", 'Analyzed' => 23, 'Account' => 44,], ], ]; $sorted_Rcv = [ [ ['Year' => "2020", 'Month' => "Feb", 'Received' => 12, 'Account' => 225,], ['Year' => "2021", 'Month' => "Feb", 'Received' => 33, 'Account' => 125,], ['Year' => "2022", 'Month' => "Feb", 'Received' => 11, 'Account' => 425,], ], [ ['Year' => "2020", 'Month' => "Feb", 'Received' => 12, 'Account' => 55,], ['Year' => "2021", 'Month' => "Feb", 'Received' => 33, 'Account' => 33,], ['Year' => "2022", 'Month' => "Feb", 'Received' => 11, 'Account' => 44,], ], ]; $merged_result = array(); foreach($sorted as $subar1){ foreach($subar1 as $val){ foreach($sorted_Rcv as $subar2){ foreach($subar2 as $val2){ if ($val['Year'] == $val2['Year'] && $val['Month'] == $val2['Month'] && $val['Account'] == $val2['Account']){ $merged_result[] = [ 'Year' => $val2['Year'], 'Month' => $val2['Month'], 'Account' => $val2['Account'], 'Analyzed' => $val['Analyzed'], 'Received' => $val2['Received'], ]; } } } } } print_r($merged_result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 44
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 44
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 42
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 42
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 40
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 40
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 38
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 38
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 37
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 37
Branch analysis from position: 24
Branch analysis from position: 19
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 38
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 40
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 42
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
filename:       /in/ZGGYI
function name:  (null)
number of ops:  49
compiled vars:  !0 = $sorted, !1 = $sorted_Rcv, !2 = $merged_result, !3 = $subar1, !4 = $val, !5 = $subar2, !6 = $val2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, <array>
   30     2        ASSIGN                                                   !2, <array>
   31     3      > FE_RESET_R                                       $10     !0, ->44
          4    > > FE_FETCH_R                                               $10, !3, ->44
   32     5    > > FE_RESET_R                                       $11     !3, ->42
          6    > > FE_FETCH_R                                               $11, !4, ->42
   33     7    > > FE_RESET_R                                       $12     !1, ->40
          8    > > FE_FETCH_R                                               $12, !5, ->40
   34     9    > > FE_RESET_R                                       $13     !5, ->38
         10    > > FE_FETCH_R                                               $13, !6, ->38
   35    11    >   FETCH_DIM_R                                      ~14     !4, 'Year'
         12        FETCH_DIM_R                                      ~15     !6, 'Year'
         13        IS_EQUAL                                         ~16     ~14, ~15
         14      > JMPZ_EX                                          ~16     ~16, ->19
         15    >   FETCH_DIM_R                                      ~17     !4, 'Month'
         16        FETCH_DIM_R                                      ~18     !6, 'Month'
         17        IS_EQUAL                                         ~19     ~17, ~18
         18        BOOL                                             ~16     ~19
         19    > > JMPZ_EX                                          ~16     ~16, ->24
         20    >   FETCH_DIM_R                                      ~20     !4, 'Account'
         21        FETCH_DIM_R                                      ~21     !6, 'Account'
         22        IS_EQUAL                                         ~22     ~20, ~21
         23        BOOL                                             ~16     ~22
         24    > > JMPZ                                                     ~16, ->37
   37    25    >   FETCH_DIM_R                                      ~24     !6, 'Year'
         26        INIT_ARRAY                                       ~25     ~24, 'Year'
   38    27        FETCH_DIM_R                                      ~26     !6, 'Month'
         28        ADD_ARRAY_ELEMENT                                ~25     ~26, 'Month'
   39    29        FETCH_DIM_R                                      ~27     !6, 'Account'
         30        ADD_ARRAY_ELEMENT                                ~25     ~27, 'Account'
   40    31        FETCH_DIM_R                                      ~28     !4, 'Analyzed'
         32        ADD_ARRAY_ELEMENT                                ~25     ~28, 'Analyzed'
   41    33        FETCH_DIM_R                                      ~29     !6, 'Received'
         34        ADD_ARRAY_ELEMENT                                ~25     ~29, 'Received'
   36    35        ASSIGN_DIM                                               !2
   41    36        OP_DATA                                                  ~25
   34    37    > > JMP                                                      ->10
         38    >   FE_FREE                                                  $13
   33    39      > JMP                                                      ->8
         40    >   FE_FREE                                                  $12
   32    41      > JMP                                                      ->6
         42    >   FE_FREE                                                  $11
   31    43      > JMP                                                      ->4
         44    >   FE_FREE                                                  $10
   50    45        INIT_FCALL                                               'print_r'
         46        SEND_VAR                                                 !2
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.01 ms | 1400 KiB | 15 Q