php - Is strpos the fastest way to search for a string in a large body of text?
问题 if (strpos(htmlentities($storage->getMessage($i)),'chocolate')) Hi, I'm using gmail oauth access to find specific text strings in email addresses. Is there a way to find text instances quicker and more efficiently than using strpos in the above code? Should I be using a hash technique? 回答1: According to the PHP manual, yes- strpos() is the quickest way to determine if one string contains another. Note: If you only want to determine if a particular needle occurs within haystack, use the faster