title: PHP: Check if objects contain a string from array
body: <p>I have been searching on Google and this platform to find an answer but I am unable to make it work. So here is my situation: </p>
  
  <p>What I want: </p>
  
  <p>To check for each object if it contains a string which is defined in an array and only output objects which pass this condition.</p>
  
  <p>What I got:</p>
  
  <pre><code>$mail_body = "&lt;table&gt;.....&lt;/table&gt;";
  $blacklist = array("PCabc", "PCxyz");
  
  foreach($blacklist as $blacklists){
                if (strpos($mail_body, $blacklists) !== false){
  
  
                  echo "&lt;br&gt;".$mail_body."&lt;br&gt;";
                }
  }
  </code></pre>
  
  <p>Turns out. This code is actually a working whitelist.^^</p>
  
  <p>But I want the opposite but it would only output an object for each string within the array if I change <code>!== false</code> to <code>== false</code>. So if I got 5 items in <code>$blacklist</code> it would output 5 times the same for every object.</p>