title: PHP: replace array value doesn't stay after foreach loop
body: <p>I'm changing the value in a multi-dimensional array and it's not staying outside of the foreach loop that's being used to traverse it.</p>
  
  <p>My array initially looks something like this:</p>
  
  <pre><code>Array
  {
    [0] =&gt; Array
     {
       [name] =&gt; Bob
       [age] =&gt; 33
       [state] =&gt; CA
       [visited] =&gt; 0
     }
     ...
  }
  </code></pre>
  
  <p>My PHP gets into it by going:</p>
  
  <pre><code>foreach ($people as $person){
   echo $person['name']
   ....
   logic for the visited variable
   ...
   $person['visited'] = $calculated_visit_value;
  }
  </code></pre>
  
  <p>If I </p>
  
  <pre><code>print_r($person)
  </code></pre>
  
  <p>at the end (but inside) of the foreach loop everything looks good, the value for visited is set.  However, if I <code>print_r($people)</code> outside of the loop, <code>$person['visited']</code> is not set.  I don't know what I'm doing wrong.  </p>
  
  <p>Help is appreciated.</p>