Getting position number from an array
<p>If I have the following array in session, can I get a item position number in each [cat]:</p>

<pre><code>Array
(
    [0] =&gt; stdClass Object
        (
            [id] =&gt; 1
            [cat] =&gt; 1
            [que] =&gt; Description here.
        )

    [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.
        )
)
</code></pre>

<p>For example the following will give me the second description, but how do I get that it has position #2 (out of 3) in [cat] == 1:</p>

<pre><code>$item = $_SESSION['questions'][2]-&gt;que;
</code></pre>

<p>The actual array is much larger and has more than 1 [cat]. The count I am trying to get is withing each such group.</p>
