title: pgp foreach merge same label but not the value
body: <p>is it possible to merge same label of foreach but not the value?</p>
  
  <p>here is what i have.</p>
  
  <pre><code>COUNTRY                 JAN 2017    FEB 2017
  Japan                   US$4,670            
  Philippines             US$4,589            
  United States           US$2,001            
  Philippines                         US$1,462        
  Japan                               US$1,271        
  Australia               US$1,096            
  Mexico                  US$998          
  United States                       US$725      
  United Arab Emirates                US$655      
  Australia                           US$471      
  United Arab Emirates    US$337          
  Singapore               US$316          
  Switzerland             US$240          
  Singapore                           US$201      
  United Kingdom          US$158          
  Germany                 US$140          
  Netherlands             US$140          
  Thailand                US$126          
  New Zealand                         US$120      
  Taiwan                  US$70           
  Sweden                  US$70           
  Austria                 US$65           
  </code></pre>
  
  <p>here is what i want to display</p>
  
  <pre><code>COUNTRY                 JAN 2017    FEB 2017
  Japan                   US$4,670    US$1,271        
  Philippines             US$4,589    US$1,462        
  United States           US$2,001    US$725                          
  Australia               US$1,096    US$471      
  Mexico                  US$998                                  
  United Arab Emirates    US$337      US$655                                          
  Singapore               US$316      US$201      
  Switzerland             US$240                                  
  United Kingdom          US$158          
  Germany                 US$140          
  Netherlands             US$140          
  Thailand                US$126          
  New Zealand                         US$120      
  Taiwan                  US$70           
  Sweden                  US$70           
  Austria                 US$65   
  </code></pre>
  
  <p>here is the output</p>
  
  <pre><code>Array
  (
      [Japan_01-2017] =&gt; 4670
      [Philippines_01-2017] =&gt; 4589
      [United States_01-2017] =&gt; 2001
      [Philippines_02-2017] =&gt; 1462
      [Japan_02-2017] =&gt; 1271
      [Australia_01-2017] =&gt; 1096
      [Mexico_01-2017] =&gt; 998
      [United States_02-2017] =&gt; 725
      [United Arab Emirates_02-2017] =&gt; 655
      [Australia_02-2017] =&gt; 471
      [United Arab Emirates_01-2017] =&gt; 337
      [Singapore_01-2017] =&gt; 316
      [Switzerland_01-2017] =&gt; 240
      [Singapore_02-2017] =&gt; 201
      [United Kingdom_01-2017] =&gt; 158
      [Germany_01-2017] =&gt; 140
      [Netherlands_01-2017] =&gt; 140
      [Thailand_01-2017] =&gt; 126
      [New Zealand_02-2017] =&gt; 120
      [Taiwan_01-2017] =&gt; 70
      [Sweden_01-2017] =&gt; 70
      [Austria_01-2017] =&gt; 65
  )
  </code></pre>
  
  <p>here is my code.</p>
  
  <pre><code>$countryarr[$i][$data['delivery_country']][$data['month'].'-'.$data['year']] = $usdval;
  
      $i++;
  }
  
  $sums = array();
  foreach ($countryarr as $key =&gt; $values) {
      foreach ($values as $label =&gt; $count) {
          foreach ($count as $label2 =&gt; $count2) {
              $cmy = $label.'_'.$label2;
              /* echo $label.' '.$label2.' '.$count2.'&lt;br/&gt;'; */
              if (!array_key_exists($cmy, $sums)) {
                  $sums[$cmy] = 0;
              }
              $sums[$cmy] += $count2;
          }
      }
  }
  arsort($sums);
  
  foreach ($sums as $nlabel =&gt; $ncount) {
          $cex = explode('_',$nlabel);
          if($cex[1]==$last_monthn){
              $lastmonthsales = $currencies-&gt;format(($ncount/$currencies-&gt;get_value(strtoupper('USD'))), true, 'USD');
          }else{
              $lastmonthsales = "";
          }
  
          if($cex[1]==$this_monthn){
              $thismonthsales = $currencies-&gt;format(($ncount/$currencies-&gt;get_value(strtoupper('USD'))), true, 'USD');
          }else{
              $thismonthsales = "";
          }
  
  ?&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;?php echo $cex[0]; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $lastmonthsales; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $thismonthsales  ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;?php
          $a++;
      }
  &gt;
  </code></pre>
  
  <p>i tried to search about this problem. but i dont get an answer about this problem.</p>
  
  <p>please help me how to achieve this problem.</p>
  
  <p>thanks.</p>