php - Altering array data around different loops

Solution:
Sounds like you want to pass array BY REFERENCE.
This means you are treating the array NOT like a typical array (a copy) but like a pointer to the$data
array.
It is similar to how you might use an object (which is not a copy but an instance itself).
You can implement this with:
foreach($data as &$item){
$item['new var'] ='my new data';
}
foreach($data as $item){
var_dump($item['new key']);//print 'my new data'
}
hope that helps
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: installation failed, reverting ./composer.json and ./composer.lock to their original content.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.