PHP Partial String Function Summary Submitmy comments
Load in
have commented
PHP Partial String Function Summary
2015-03-10PHP100 Chinese webPHP100 Chinese web
PHP100 Chinese web
number
Function Introduction Internet Developer community, providing relevant technical information services, technology exchange platform
We all know that in either language, string manipulation is an important foundation, often simple and important. PHP provides us with a large number of string manipulation functions, powerful, use is relatively simple, here for you to summarize the nine class string function.
1. Find the character position function
Strpos ($str, Search,[int]): Find the first position of search in $str start with int
Stripos ($str, search,[int]): function returns the position of the first occurrence of a string in another string
Strrpos ($str, Search,[int]): Find the last occurrence of search in $str from int
2. Extracting sub-character functions (double-byte)
Submit ($str, int start[,int length]): Extracts [length string] from strat position in $str.
Strstr ($str 1, $str 2): Searches for $str2 from $STR1 (the first position) and intercepts the end string from it, or false if none.
The Stristr () function is the same as STRSTR, but is not case sensitive.
STRRCHR () prompt returned from the last word searched; use: Fetch the file name in the path
3. PHP string function for replacing strings
Str_replace (Search,replace, $str): Find search from $STR Replace with replace
Str_irreplace (Search,replace, $STR):
STRTR ($str, search,replace): Replace in this function cannot be "";
Substr_replace ($Str, $rep, $start [, length]) $str The original string, $rep the replaced new string, $start the starting position, $length the length of the replacement, which is optional
4. Character length
int strlen ($STR)
5. Compare character functions
int strcmp ($str 1, $str 2): $str 1>=< $str 2 are positive 1,0,-1 (string comparison)
STRCASECMP () ditto (no case)
STRNATCMP ("4", "14") compare strings by natural sort
STRNATCASECMP () ibid. (case sensitive)
6. Splitting the array of PHP string functions
Str_split ($str, Len): Splits the $STR by Len length returns the array
Split (search, $str [, int]): Splits the $str by the search character returns the array int is split several times, the back will not be split
Expload (Search, $str [, int])
7. Remove spaces
LTrim, RTrim, Trim
8. HTML code related functions
NL2BR (): causes N to be converted to
。
Strip_tags ($str [, '
']): Removes HTML and PHP tags. in $str all HTML and PHP code will be removed, optional parameters for HTML and PHP code function is to be preserved
such as: Echo Strip_tags ($text, '
');
Htmlspecialchars ($str [, Parameters]): page normal output HTML code parameter is the conversion mode
9. Character-case-conversion PHP String functions
Strtolower ($STR): string converted to lowercase
Strtoupper ($STR): string converted to uppercase
Ucfirst ($STR): Converts the first character of a function to uppercase
Ucwords ($STR): Converts the first letter of each word to uppercase
Report:
PHP string function library, collected 51 PHP processing string functions. This includes all aspects of calculating string lengths, splitting strings, finding strings, and so on.
Addslashes: String joins a slash.
Bin2Hex: binary turns into 16 decimal.
Chop: Remove continuous whitespace.
CHR: The character that returns the ordinal value.
Chunk_split: Divides the string into small segments.
Convert_cyr_string: Convert to another string.
Crypt: The string is encrypted with DES encoding.
Echo: the output string.
Explode: Cuts the string.
Flush: Clear out the output buffer.
Get_meta_tags: Extract data from all meta tags of the file.
Htmlspecialchars: Converts special characters into HTML format.
Htmlentities: Turns all characters into HTML strings.
Implode: Turns the array into a string.
Join: Turns the array into a string.
LTrim: Remove continuous whitespace.
MD5: Computes the MD5 of the string.
NL2BR: Converts the newline character to.
ORD: Returns the ordinal value of a character.
PARSE_STR: Parses the query string into a variable.
Print: Output string.
printf: Output formatted string.
Quoted_printable_decode converts a QP encoded string into a 8-bit string.
Quotemeta: Add reference symbol.
Rawurldecode: Restore from a URL-specific format string to a normal string.
Rawurlencode: Encodes a string into a URL-specific format.
SetLocale: Configure geo-information.
Similar_text: Calculates the similarity of strings.
Soundex: Calculating the phonetic value of a string
sprintf: Formats the string.
STRCHR: Look for the first occurrence of the character.
strcmp: string comparison.
STRCSPN: The length of different strings.
Strip_tags: Remove HTML and PHP markup.
Stripslashes: Remove the backslash character.
Strlen: Gets the string length.
Strrpos: Looks for a character in the string where the last occurrence occurs.
Strpos: Looks for a character in a string that appears first.
STRRCHR: Gets the string that appears at the last occurrence of a character.
Strrev: Reverses the string.
STRSPN: Find out how many strings fall in another string mask.
Strstr: Returns the string from the beginning of the string to the end of a string.
Strtok: Cuts the string.
Strtolower: All strings are converted to lowercase.
Strtoupper: All strings are capitalized.
Str_replace: String substitution.
STRTR: Converts some characters.
SUBSTR: Takes a partial string.
Trim: Truncate the space between the end of the string.
Ucfirst: capitalizes the first character of the string.
Ucwords: capitalizes the first letter of each word in a string.
Read the original reading
Report
Sweep
Follow the public number
From for notes (Wiz)
PHP Partial String Function Summary