title: Item position in an array
body: <p>If I have id number and an array in the following format, how do I find out what count (position number) 'Red' among all other items where cat == 4? The answer I am looking for #3 of 4.
      Array
      (
          [0] => stdClass Object
              (
                  [id] => 1
                  [cat] => 1
                  [que] => Description here.
              )</p>
  
  <pre><code>    [1] =&gt; stdClass Object
          (
              [id] =&gt; 2
              [cat] =&gt; 1
              [que] =&gt; Description here.
          )
  
      [2] =&gt; stdClass Object
          (
              [id] =&gt; 3
              [cat] =&gt; 1
              [que] =&gt; Description here.
          )
   ....
  
      [31] =&gt; stdClass Object
          (
              [id] =&gt; 32
              [cat] =&gt; 4
              [que] =&gt; Description here.
          )
  
      [32] =&gt; stdClass Object
          (
              [id] =&gt; 33
              [cat] =&gt; 4
              [que] =&gt; Description here.
          )
      [33] =&gt; stdClass Object
          (
              [id] =&gt; 34
              [cat] =&gt; 4
              [que] =&gt; Red.
          )
  
      [34] =&gt; stdClass Object
          (
              [id] =&gt; 35
              [cat] =&gt; 4
              [que] =&gt; Description here.
          )
  )
  </code></pre>
  
  <p>Do I need to split array and then loop? Lost...</p>
  
  <p>--------- EDIT ----------</p>
  
  <p>OK, I did a bad job explaining...</p>
  
  <p>What I meant was: there are many objects withing this array. They are broken into groups, categories. [cat] is the value for each group. There are multiple items in each group. What I was hoping to get was a number of items in each group and the position of particular item withing that group, for example:  4 out of 12. </p>