title: how to alternate foreach statements PHP
body: <p>How do I alternate these foreach statements in the sense that after one result of the first foreach statement is echoed one result from the second foreach statement will be echoed? Here are the two foreach statements.  </p>
  
  <pre><code> foreach($anchors as $a) {
      $text = $a-&gt;nodeValue;
      $href = $a-&gt;getAttribute('href');
  $i++;
  
  if ($i &gt; 16) {
      if (strpos($text, "by owner") === false) {
       if (strpos($text, "map") === false) {
  
  
            echo "&lt;a href =' ".$href." '&gt;".$text."&lt;/a&gt;&lt;br/&gt;";
  
  
       }
      }
    }
  
    }
  
  
  foreach($span as $s) {
  echo "&lt;br&gt;".$s-&gt;nodeValue."&lt;br&gt;" ;
  
  }
  </code></pre>