title: How to avoid duplicates in nested foreach loop php
body: <p>Why are values are getting printed multiple times (see images below). I need to print them only once. </p>
  
  <pre><code>&lt;?php foreach($patchData3 as $tes3){?&gt; 
      &lt;?php foreach($patchData1 as $tes){?&gt;
          &lt;tr class="&lt;?php if($tes-&gt;PATCH == $tes3-&gt;PATCH) {echo "red_color"; } ?&gt;"&gt; 
              &lt;td&gt;&lt;?php echo $tes-&gt;HOSTNAME;?&gt;&lt;/td&gt;
              &lt;td&gt;&lt;?php echo $tes-&gt;VERSION;?&gt;&lt;/td&gt; 
              &lt;td&gt;&lt;?php echo $tes-&gt;PATCH;?&gt;&lt;/td&gt; &lt;!--bgcolor="#FF0000"--&gt;
          &lt;/tr&gt;   
      &lt;?php } ?&gt;
  &lt;?php }?&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/uzVdg.jpg" alt="enter image description here"><br>
  <img src="https://i.stack.imgur.com/ay61W.jpg" alt="enter image description here"></p>