101k views
3 votes
How to add values from a while loop into an array python

1 Answer

2 votes

Answer:

Declare the $items array outside the loop and use $items [] to add items to the array: $items = array (); foreach ($group_membership as $username) { $items [] = $username; } print_r ($items); ### Use

Step-by-step explanation:

User Lahiru Ashan
by
5.9k points