title: add to multidimensional array with key value pair
body: <p>Im returning a array that resembles this idea</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [GRP] =&gt; "Group1"
              [ITM] =&gt; "Item1"
          )
      [1] =&gt; Array
          (
              [GRP] =&gt; "Group1"
              [ITM] =&gt; "Item2"
          )
      [2] =&gt; Array
          (
              [GRP] =&gt; "Group1"
              [ITM] =&gt; "Item1"
          )
      [3] =&gt; Array
          (
              [GRP] =&gt; "Group2"
              [ITM] =&gt; "Item1"
          )
      [4] =&gt; Array
          (
              [GRP] =&gt; "Group2"
              [ITM] =&gt; "Item2"
          )
  )
  </code></pre>
  
  <p>I want to be able to search through the array and sum the amount of <code>items</code>
  For the above example the result should be something like</p>
  
  <pre><code>Array
  (
      ["Group1"] =&gt; Array
          (
              ["Item1"] =&gt; 2
              ["Item2"] =&gt; 1
          )
      ["Group2"] =&gt; Array
          (
              ["Item1"] =&gt; 1
              ["Item2"] =&gt; 1
          )
  )
  </code></pre>
  
  <p>But I have no idea how to approach this.</p>
  
  <p>I guess the searching is tricky for me.
  I though of using someting like this</p>
  
  <pre><code>foreach($array as $row){
      $grp = $row["GRP"];
      $itm = $row["ITM"];
  
      $grpFound = array_search($grp, $newArray);
      if($grpFound){
          //GRP found, now search for ITM
          $itmFound = array_search($grp, $newArray[$grp]);
          if($itmFound){
              // increase the key value of the item
              $newArray[$grp][$itm] += 1
          }else{
              //Add new item to array group with a item value of 1
              $newArray[$grp] = [$itm =&gt; 1]
          }
      }else{
          // ADD new group to array
          $newArray[] = $grp;
      }
  }
  </code></pre>
  
  <p>This is what I have in my head, I know its kind of psuedo-ish code, but please tell me if im on the right track here.</p>