I recently found a need to find the longest common substring in an array of strings in PHP. A couple of Google searches didn’t return any relevant solutions, so I decided to roll my own. I haven’t benchmarked this yet for large strings and/or arrays, but it does what I needed it to for my own purpose.

Could not embed GitHub Gist 1021218: API rate limit exceeded for 69.163.242.187. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

Example:

Could not embed GitHub Gist 1021218: API rate limit exceeded for 69.163.242.187. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)