title: PHP How can I pass values from one array to another?
body: <p>I'm trying to pass some of the values from theOptions array and drop them into a new array called $theDefaults.</p>
  
  <pre><code>$theOptions = array(
  
      'item1' =&gt; array('title'=&gt;'Title 1','attribute'=&gt;'Attribute 1','thing'=&gt;'Thing 1'),
      'item2' =&gt; array('title'=&gt;'Title 2','attribute'=&gt;'Attribute 2','thing'=&gt;'Thing 2'),
      'item3' =&gt; array('title'=&gt;'Title 3','attribute'=&gt;'Attribute 3','thing'=&gt;'Thing 3')
  
  );
  </code></pre>
  
  <p>So, $theDefaults array should look like this:</p>
  
  <pre><code>$theDefaults = array(
  
      'Title 1' =&gt; 'Attribute 1',
      'Title 2' =&gt; 'Attribute 2',
      'Title 3' =&gt; 'Attribute 3'
  
  );
  </code></pre>
  
  <p>However, I cannot figure out how to do this.
  Have tried this but it is clearly not quite working.</p>
  
  <blockquote>
  <pre><code>$theDefaults = array();
  
  foreach($theOptions as $k=&gt;$v) {
      array_push($theDefaults, $v['title'], $v['attribute']); 
  }
  </code></pre>
  </blockquote>
  
  <p>but when I run this...</p>
  
  <pre><code>foreach($theDefaults as $k=&gt;$v) {
      echo $k .' :'.$v;
  }
  </code></pre>
  
  <p>It returns this.
  0 :Title 11 :Attribute 12 :Title 23 :Attribute 24 :Title 35 :Attribute 3</p>
  
  <p>Looks to be soooo close, but why are the numbers in the array?</p>