title: PHP 7 best/concise way to pass both key and value to a function
body: <p>I have a query as to if something can be improved.</p>
  
  <p>I have an array with keys and values. </p>
  
  <p>I want to pass these keys and values into a function with each row as separate entities.</p>
  
  <p>array example:</p>
  
  <blockquote>
  <pre><code>[basket][products] {
      [10] =&gt; 3 
      [12] =&gt; 5
      [15] =&gt; 1
    }
  </code></pre>
  </blockquote>
  
  <p>I currently use: </p>
  
  <pre><code>    foreach($data['basket']['products'] as $product =&gt; $quantity) {
          $basketClass-&gt;addItem($product,$quantity);
      }
      unset($product,$quantity);
  </code></pre>
  
  <p>Which is 4 lines. </p>
  
  <p>I don't want to <em>change</em> the values in the array simply I want to apply them all to the <code>-&gt;addItem</code> function row by row. </p>
  
  <p>Is there a shorter, more concise or "cleaner" way of doing this, with particular emphesis on new PHP7 abilities? </p>