title: Retrieve key value based on another key value within the same row of a PHP array
body: <p>I'm working with an indexed PHP array that resembles this structure:</p>
  
  <pre><code>$result =   Array(
    [0] =&gt; Array([storepickup_id] =&gt; 3[sku] =&gt; 691294[inventory] =&gt; 33[reserve] =&gt; )
    [1] =&gt; Array([storepickup_id] =&gt; 3[sku] =&gt; 692284[inventory] =&gt; 3[reserve] =&gt; )
    [2] =&gt; Array([storepickup_id] =&gt; 3[sku] =&gt; 692289[inventory] =&gt; 4[reserve] =&gt; )
    [3] =&gt; Array([storepickup_id] =&gt; 3[sku] =&gt; 693510[inventory] =&gt; 8[reserve] =&gt; )
    [4] =&gt; Array([storepickup_id] =&gt; 3[sku] =&gt; 150893[inventory] =&gt; 2[reserve] =&gt; )
    [5] =&gt; Array([storepickup_id] =&gt; 3[sku] =&gt; 150906[inventory] =&gt; 4[reserve] =&gt; )
  )
  </code></pre>
  
  <p>I'm attempting to filter the above array with a prebuilt FOR EACH statement from that looks like this:</p>
  
  <pre><code>&lt;?php foreach ($_productCollection as $_product): ?&gt;
      &lt;?php
      echo "SKU: " . $_product-&gt;getSku();
      echo "INVENTORY: " . array_column($result, 'inventory', $_product-&gt;getSku());
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>So if $_product-getSku() yields 691294, I would like to retrieve the corresponding 'inventory' value from the same index/row of the PHP array.</p>
  
  <p>The above array_column within the FOR EACH did not work. I also attempted a function based on array_filter that failed to yield proper results:</p>
  
  <pre><code>&lt;?php foreach ($_productCollection as $_product): ?&gt;
    &lt;?php
    function my_function($item_values)
    {
        if ($item_values = $_product-&gt;getSku())
        {
            return true;
        }
        return false;
    }
    $sku = $_product-&gt;getSku();
    print_r(array_filter($sku,"my_function"));
    ?&gt;
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>Is there a better approach when working with multidimensional arrays such as above? Thanks in advance.</p>