title: Count array values in multidimensional array based on a different value
body: <p>I'm trying to count values of an array based on a different value in the array.</p>
  
  <p>Here is an example, with the following array:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [user] =&gt; 53
              [grade] =&gt; A
          )
  
      [1] =&gt; Array
          (
              [user] =&gt; 40
              [grade] =&gt; A
          )
  
      [2] =&gt; Array
          (
              [user] =&gt; 53
              [grade] =&gt; A
          )
  
      [3] =&gt; Array
          (
              [user] =&gt; 53
              [grade] =&gt; B
          )
  
      [4] =&gt; Array
          (
              [user] =&gt; 53
              [grade] =&gt; C
          )
  
      [5] =&gt; Array
          (
              [user] =&gt; 52
              [grade] =&gt; A
          )
  )
  </code></pre>
  
  <p>I need a way to count all of a specific grade for a specific user.</p>
  
  <p>My first thought was <code>array_count_values()</code>, which would only work to get me the total amount of a specific grade, not based on the user. Other than that idea, I haven't been able to think of any more, and am having difficulty finding good search terms for such a thing to try to find a solution.</p>
  
  <p>I need a way to say "User X has Y amount of grade Z" (User <strong>53</strong> has <strong>2</strong> grade <strong>A</strong>)</p>
  
  <p>How can I extract the information I need from the array?</p>