title: How can I find the Largest Common Substring between two strings in PHP?
body: <p>Is there a fast algorithm for finding the Largest Common Substring in two <code>strings</code> or is it an NPComplete problem?</p>
  
  <p>In PHP I can find a needle in a haystack:</p>
  
  <pre><code>&lt;?php
  
  if (strstr("there is a needle in a haystack", "needle")) {
      echo "found&lt;br&gt;\n";
  }
  ?&gt;
  </code></pre>
  
  <p>I guess I could do this in a loop over one of the <code>strings</code> but that would be very expensive! Especially since my application of this is to search a database of email and look for spam (i.e. similar emails sent by the same person). </p>
  
  <p>Does anyone have any PHP code they can throw out there?</p>