title: create a key value array based on array two values from different array
body: <p>I have this array:</p>
  
  <pre><code>$priceTableData = array(
  
      array('productId'=&gt;1,'price'=&gt;50,'discount'=&gt;12),
      array('productId'=&gt;2,'price'=&gt;22,'discount'=&gt;2),
      array('productId'=&gt;3,'price'=&gt;7,'discount'=&gt;0),
      array('productId'=&gt;4,'price'=&gt;9,'discount'=&gt;0),
      array('productId'=&gt;5,'price'=&gt;35,'discount'=&gt;7),
  
  );
  </code></pre>
  
  <p>and I want to get this array out of it:</p>
  
  <pre><code>array(5) { 
  [1]=&gt; int(12) 
  [2]=&gt; int(2) 
  [3]=&gt; int(0) 
  [4]=&gt; int(0) 
  [5]=&gt; int(7) 
  }
  </code></pre>
  
  <p>and I used this custom method to do so,</p>
  
  <pre><code>function getDiscounts(array $priceData){
  
      $result = array();
  
      foreach ($priceData as $array){
  
          $result[$array['productId']] = $array['discount'];
  
      }
      return $result;
  }
  </code></pre>
  
  <p>then I used it as this:</p>
  
  <pre><code>var_dump(getDiscounts($priceTableData));
  </code></pre>
  
  <p><strong>my question is:</strong> is there a native way of doing so, rather than having a custom function for it?</p>
  
  <p>Thanks.</p>