Result :string '234567890'(length=9) strrpos finds the last occurrence of a character in a string. Syntax: int strrpos(string haystack,char needle); This function is used to find the last position where the character needle appears in the string haystack. Note that needle can only be one character, Chinese characters, etc. are not suitable. If the specified character is not found, a false value is returned. strpos finds the first occurrence of a character in a string. Syntax: int strpos(string haystack,string needle, int [offset]); This function is used to find the position where the character needle first appears in the string haystack. Note that needle can only be one character, Chinese characters, etc. are not suitable. If the specified character is not found, a false value is returned. The offset parameter can be omitted, and y is used to start searching from offset. strspn Find the number of times a string falls within the mask of another string. Syntax: int strspn(string str1,string str2); This function uses the str2 string as a mask and can be used to calculate how many characters in the str1 string fall within the str2 mask. Detailed explanation of PHP string comparison and search methods PHP function usage reference for comparing string similarity Introduction to the usage of PHP string comparison functions strcmp() and strcasecmp() PHP example code for comparing string similarity |