比较没有停用词PHP的字符串

I want to compare 2 string without stop words like

LIKE terms, are ok or contains: example: "it's two" or "two" would be considered equal.

$stopwords = array("it's", 'foo', '')
if (trim(str_replace($stopwords, "", $string1)) == $string2) print 'True'

You can use strpos:

if ( strpos("it's two", "two") !== false ) {
  // string "two" found in "it's two"
}

You'll need a list of 'stop words'. You might be able to find one online, otherwise you'll have to set up one yourself.

Then it's fairly easy, use str_replace to replace all occurrences of stop words and do your comparision thereafter.

This sounds like homework to me so i'll explain it in pseudo code to help you get going.

Define an array that contains all "stop words".

Split the strings you want to compare on empty spaces (" ")

Now iterate through the array you get, skipping all tokens that exist in the "stop words" array.