title: Adding multiple items to a PHP array in a foreach loop - is there a nicer way?
body: <p><strong>Sample Code</strong>  </p>
  
  <pre><code>&lt;?php 
      $items = array(
          array(
              'forename' =&gt; 'Foo',
              'surname' =&gt; 'Bar'
          ),
              array(
              'forename' =&gt; 'Bar',
              'surname' =&gt; 'Foo'
          )
      );
  
      $arr = array();
      $i = 0;
  
      foreach($items as $item){
          $arr[$i]['name'] = $item['forename'];
          $arr[$i]['surname'] = $item['surname'];
          $i++;
      }
  
      echo "&lt;pre&gt;".print_r($arr, true)."&lt;/pre&gt;";
  ?&gt;
  </code></pre>
  
  <p><strong>Result</strong>  </p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [name] =&gt; Foo
              [surname] =&gt; Bar
          )
  
      [1] =&gt; Array
          (
              [name] =&gt; Bar
              [surname] =&gt; Foo
          )
  )
  </code></pre>
  
  <p>The result is perfectly acceptable and the code is readable.<br>
  My question is: <strong>is there a better / more efficient / prettier way to do this?</strong></p>