need to store values from foreach loop into array

Posted by Brad on Stack Overflow See other posts from Stack Overflow or by Brad
Published on 2010-06-15T13:35:31Z Indexed on 2010/06/15 13:42 UTC
Read the original article Hit count: 293

Filed under:
|

Need to store values from foreach loop into an array, need help doing that. Code below does not work, only stores the last value, tried $items .= ..., but that is not doing the trick either, any help will be appreciated.

<?php
foreach($group_membership as $i => $username) {
 $items = array($username);
}

print_r($items);
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about foreach-loop