title: Comparing a string to substrings in a PHP array
body: <p>I currently have an array of substrings and I'm trying to find matches in a long string.  I currently loop through the array and compare each element to the string, but once the array gets bigger this is taking a lot of time.  Is there a faster way to do this?</p>
  
  <pre><code>$substring_list = array('/item/', '/mail/', '/product/');
  $string = 'http://www.mystore.com/wishlist/item/';
  
  foreach ($substring_list as $substring) {
      if (strpos($string, $substring) !== false) {
          $result = false;
          break;
      }
  }
  </code></pre>
  
  <p>This finds the substring <code>'/item/'</code> in the string <code>'http://www.mystore.com/wishlist/item/'</code> and returns false.</p>
  
  <p>I have searched through all the questions here, but I can only find how to do it the other way (substring matching in an array of strings).</p>