I'm within a foreach loop and I'd like to add multiple values to an array
$allcustomers = array();
foreach ($customers as $entry) {
$allcustomers['User Email'] = $user_meta['0']['user_email'];
$allcustomers['Customer ID'] = $customer_id;
}
This is what it's outputting:
Array
(
[User Email] => [email protected]
[Customer ID] => 18060
)
So it's just overwriting the one array constantly. I want it to output the same but for every customer.
How do I create an array for each loop?
Array
(
[0] => Array
(
[User Email] => [email protected]
[Customer ID] => 184
)
[1] => Array
(
[User Email] => [email protected]
[Customer ID] => 185
)
[2] => Array
(
[User Email] => [email protected]
[Customer ID] => 183
)