title: Return array from function with specified key and it's value
body: <pre><code>function do_get_array() {
  
      $posts[] = array(
          'name'          =&gt; 'Page',
          'icon'          =&gt; 'fa fa-users',
          'fields'        =&gt; array(
              array(
                  'field_name'       =&gt; 'Publisher Logo',
                  'id'               =&gt; 'pub_logo',
                  'type'             =&gt; 'text',
              ),
          ),
      );
  
      $posts[] = array(
          'name'          =&gt; 'Slideshow',
          'icon'          =&gt; 'fa fa-users',
          'fields'        =&gt; array(
              array(
                  'field_name'       =&gt; 'Publisher Logo2',
                  'id'               =&gt; 'pub_logob',
                  'type'             =&gt; 'text',
              ),
          ),
      );
  return $posts;
  
  } 
  </code></pre>
  
  <p>getting arrays from above function.</p>
  
  <pre><code>$posts = do_get_array();
  $return = array();
  foreach ($posts as $post) {
      $return['name'] = $post['name'];
      $return['icon'] = $post['icon'];
  
  }
  print_r($return);
  </code></pre>
  
  <p>but it only returns second array.
  I want it to return all the arrays value with key that i provided.
  I am actually new to php that's why i think i have some confusion. </p>