Extract values from multidimensional array using key value
<p>I wonder if someone can help me extract values from an array by key value rather than array number.</p>

<pre><code>$json = json_decode($stock, true);
print_r($json);
$sims = $json['stock'][1]['sims'];

foreach ($sims as $sim)
{
    echo nl2br($sim . "\n");
}
</code></pre>

<p>The output from <code>print_r($json)</code> is:</p>

<pre><code>Array ( [stock] =&gt; Array (
[0] =&gt; Array
( [operator] =&gt; ECL [sims] =&gt; Array
( [0] =&gt; 8944122616994 [1] =&gt; 89650264517182 [2] =&gt; 894412265075 [3] =&gt; 894412 ) )
[1] =&gt; Array
( [operator] =&gt; JT [sims] =&gt; Array
( [0] =&gt; 89445023065 [1] =&gt; 894156673081 [2] =&gt; 8944501 [3] =&gt; 89445027 ) ) ) )
</code></pre>

<p>It appears that sometimes the data I want is not in array number 1 hence I would like to extract it based on <code>"[operator] =&gt; JT"</code> I've been trying various ideas but it never seems to work.</p>