The first chapter focuses on the common operations of strings. If you understand the following functions, you can skip this chapter. Strpos (): searches for the position of another string in a string. If the returned value is false, a number, or null, You need to judge substr (): specify the start position and length of a substring from a string.
The first chapter focuses on the common operations of strings. If you understand the following functions, you can skip this chapter. Strpos (): searches for the position of another string in a string. the return value is false, a number, or null. You must use ===to judge substr (): specify the start position and length of a substring from a string.
Chapter 1 focuses onStringIf you understand the following functions, skip this section.
Strpos (): InStringFind anotherStringThe return value is false, a number, or null, which must be determined by =.
Substr (): fromStringSpecify the start position and length of the childString
Substr_replace (): similar to substr (), the difference is thatStringUse anotherStringReplace
Strlen (): GetString. Here we get the length of the byte, which is not applicable to Chinese. for Chinese, we use mb_strlen ()
Strrev (): reverse the originalString
Array_reverse (): inverted Array
Str_replace (): Non-regularStringReplacement function, supports escapeString
Preg_replace_callback (): The methods starting with "preg _" are mostly regular expressions. This is the method for processing the replaced result.
Str_split (): split by lengthStringTo the array. By default, the length is one character.
Ucfirst ():StringThe first character in uppercase
Ucwords ():StringThe first word in
Strtoupper (): converts all characters to uppercase.
Strtolower (): converts all characters to lowercase letters.
Trim (): RemoveStringYou can also remove line breaks and tabs. The related functions are ltrim and rtrim.
Fputcsv (): saves data in the format of arrays as CSV data.
Fgetcsv (): similar to fputcsv, it only extracts csv data and saves it as an array variable.
Ob_start (): Enable the output buffer. All output content is displayed when the ob_get_contents () function is called.
Ob_end_clean (): clears the output cache and closes the cache. It is generally used after the ob_get_contents () function is called.
Ob_get_contents (): Get the content of the output buffer.
Pack (): Format fixed-lengthString
Unpack (): ConvertStringData is decomposed into variables.
Str_pad (): Set a length. When the number of characters in the target variable is insufficient, use anotherStringFill
Explode ():StringSplits an array by the specified separator.
Join (): combines an array into a separatorString, Alias function implode ()
Preg_split (): separated by a given regular expression.String
Wordwrap (): SetStringThe interrupt is of the specified length.String
Returned directory