title: How to make sure the value is reset in a 'foreach' loop in PHP?
body: <p>I was writing a simple PHP page and a few <code>foreach</code> loops were used.</p>
  
  <p>Here are the scripts:</p>
  
  <pre><code>$arrs = array("a", "b", "c");
  
  foreach ($arrs as $arr) {
      if(substr($arr,0,1)=="b") {
          echo "This is b";
      }     
  } // End of first 'foreach' loop, and I didn't use 'ifelse' here.
  </code></pre>
  
  <p>And when this <code>foreach</code> ends, I wrote another <code>foreach</code> loop in which all the values in the <code>foreach</code> loop was the same as in the previous <code>foreach</code>.</p>
  
  <pre><code>foreach ($arrs as $arr) {
      if(substr($arr,0,1)=="c") {
          echo "This is c";
      }     
  }
  </code></pre>
  
  <p>I am not sure if it is a good practice to have two <code>foreach</code> loops with the same values and keys.</p>
  
  <p>Will the values get overwritten in the first <code>foreach</code> loop?</p>