php - How to store values from foreach loop into an array? -


Values ​​need to be stored in the array from the foreach loop, the code below does not work. Does only store the last value, have tried $ items. = ..., but if he is not walking, then any help would be appreciated.

  & lt; Php foreign currency ($ group_membership $ i = & gt; $ as username) {$ items = array ($ username); } Print_r ($ item); ? & Gt;  

loop and declare an array out of $ items $ item [] to add items to the array:

  $ items = array (); Forex Currency ($ group_membership $ username) {$ item [] = $ username; } Print_r ($ item);  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -