title: How to store values from foreach loop into an array?
body: <p>Need to store values from foreach loop into an array, need help doing that. </p>
  
  <p>The code below does not work, only stores the last value, tried <code>$items .= ...,</code> but that is not doing the trick either, any help will be appreciated.</p>
  
  <pre class="lang-php prettyprint-override"><code>foreach($group_membership as $i =&gt; $username) {
      $items = array($username);
  }
  
  print_r($items);
  </code></pre>