title: Access outside array created in one foreach loop in a new foreach loop
body: <p>It must be simple - but I can't figure it out. I have created an <code>array</code> in a <code>foreach</code> loop - like this:</p>
  
  <pre><code>foreach ($fixturesarray as $value) { 
      if ($i++ % 9 == 3) { 
          $hometeamarray[] = $value; 
      }
  }
  </code></pre>
  
  <p>and it works fine... Then I would like to use the array (<code>$hometeamarray</code>) in another <code>foreach</code> loop - like this:</p>
  
  <pre><code>foreach ($xmlteams-&gt;children() as $output) { 
      if (in_array($output-&gt;OPPONENT, $hometeamarray)) { 
          $result[] = (string) $output-&gt;ALIGNED; 
      }
  }
  </code></pre>
  
  <p>I need to check each value in <code>$hometeamarray</code> in the node of the XML-file called OPPONENT and then replace them with the node of the XML-file called ALIGNED. It all goes very well except that I can't access the <code>$hometeamarray</code> in the second foreach loop??? </p>