A review of 1.php string functions
PHP Lookup function to locate the location where the string you are looking for appears
Strpos (string position) string Locator function
Strpos ($strA, $strB) is used to query the position of the string $strb in the string $str, which is strictly case-sensitive. Stripos () is the same as the above function, when one of the distinctions is that this method is case-insensitive;
Strrpos () uses the same method as the above function, but this function is used to find the last position $strb appears in $stra.
Intercept functions for strings
SUBSTR ($strA, 3,5) The function means to intercept the string $stra from the third character, and the length of the intercept is 5.
Strstr ($strA, $strB) intercepts the string $stra from the position where $STRB occurred, intercepts the tail of the string, and returns the truncated string.
STRISTR () uses the same method as above, but the Intercept function is case-insensitive.
Strrchar from the last position that appears, this function is often used to get the folder where the file is located.
Replace function
Str_replace ("A", "B", $strA) returns the replaced string, the function is to replace the $stra in the first, a to B; the length of a and B can be different
STRTR ($strA, ' A ', ' B ') returns the replaced string, where the length of a and B must be the same strictly first.
Substr_replace ($strA, $strB, $star [, length]) replaces the string $stra from the start position, the length of the replacement, and finally returns the replacement string to $STRB;
Comparison functions for strings
strcmp ($a, $b) $a > = < $b, respectively, the 1,0,-1 is returned;
function to remove two spaces from a string
Trim () The function is to remove spaces on either side of the string
Functions that insert spaces
Chunk_split ($a, 1, "/") the function is to insert the string $ A every other character, and the "/" is inserted;
Functions for database character segment operations
Addslashes () converts spaces and quotes in accepted strings into special symbols
PHP Common function string Operation review