Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

PHP 5 String function


May 11, 2021 PHP


Table of contents


PHP 5 String function

This section describes the String functions that need to be used in PHP, and we describe them!


PHP 5 String function

The PHP String function is part of the PHP core. These functions can be used without installation.


function describe
addcslashes() Returns the string of the anti-slash before the specified characters.
addslashes() Returns a string to add a counter slash before a predefined character.
bin2hex() Convert the string of the ASCII character to a hexadecimal value.
chop() Remove blank characters or other characters on the right side of the string.
chr() Returns the character from the specified ASCII value.
chunk_split() Segment strings into a series of smaller parts.
convert_cyr_string() Converting the string from a Cyrillic character set to another.
convert_uudecode() Decoding the UUENCODE-encoded string.
convert_uuencode() Use the UUENCODE algorithm to encode the string.
count_chars() Returns the information of the characters used by the string.
crc32() Calculate 32-bit CRCs of a string (cycle redundancy check).
crypt() One-way string encryption method (HASHING).
echo() Output one or more strings.
explode() Disperse the string into an array.
fprintf() Write the formatted string to the specified output stream.
get_html_translation_table() Returns the translation table used by htmlspecialchars () and htmlentities ().
hebrev() Convert Hebrew text to visible text.
hebrevc() 把希伯来(Hebrew)文本转换为可见文本,并把新行(\n)转换为 <br>。
hex2bin() Convert a string of hexadecimal values to ASCII characters.
html_entity_decode() Convert HTML entities to characters.
htmlentities() Convert characters to an HTML entity.
htmlspecialchars_decode() Convert some predefined HTML entities to characters.
htmlspecialchars() Convert some predefined characters to an HTML entity.
implode() Returns a string that is combined by array elements.
join() Alias of Implode ().
lcfirst() Convert the first character in the string to lowercase.
levenshtein() Returns the LEVENSHTEIN distance between the two strings.
localeconv() Returns local numbers and currency format information.
ltrim() Remove blank characters or other characters on the left side of the string.
md5() The MD5 hash of the string is calculated.
md5_file() Calculate the MD5 hash of the file.
metaphone() Calculate the Metaphone key of the string.
money_format() Returns a string that is formatted as a currency string.
nl_langinfo() Returns the specified local information.
nl2br() Insert the HTML line break before each new line in the string.
number_format() Format numbers through thousands of packets.
ord() Returns the ASCII value of the first character in the string.
parse_str() Resolve the query string to the variable.
print() Output one or more strings.
printf() Output formatted strings.
quoted_printable_decode() Convert the QuoteD-Printable string to an 8-bit string.
quoted_printable_encode() Convert 8-bit strings to quoted-printable strings.
quotemeta() Quote.
rtrim() Remove blank characters or other characters on the right side of the string.
setlocale() Set regional information (geographical information).
sha1() The SHA-1 hash of the string is calculated.
sha1_file() Calculate the SHA-1 hash.
similar_text() Calculate the similarity of two strings.
soundex() Calculate the SoundEx key of the string.
sprintf() Write the formatted string into a variable.
sscanf() An input from a string is parsed according to the specified format.
str_getcsv() Resolve the CSV string to an array.
str_ireplace() Replace some characters in the string (case insensitive).
str_pad() Pack the string as a new length.
str_repeat() Repeat the string to the specified number of times.
str_replace() Replace some characters in the string (case sensitive).
str_rot13() Perform ROT13 encoding for strings.
str_shuffle() Randomly disrupt all characters in the string.
str_split() Squate strings into an array.
str_word_count() Calculate the number of words in the string.
strcasecmp() Compare two strings (case insensitive).
strchr() Find the first appearance of the string in another string.(STRSTR () alias.)
strcmp() Compare two strings (case sensitive).
strcoll() Compare two strings (according to local settings).
strcspn() Returns the number of characters looking for a string before finding any specified characters.
strip_tags() Strip the HTML and PHP tags in the string.
stripcslashes() Delete the backslash added by the addcslashes () function.
stripslashes() Delete the backslash added by the addslashes () function.
stripos() Returns the string in the first place in another string (case insensitive).
stristr() Find a string where the first appearance in another string (case is not sensitive).
strlen() Returns the length of the string.
strnatcasecmp() Use a "natural sort" algorithm to compare two strings (case sensitive).
strnatcmp() Use a "natural sort" algorithm to compare two strings (case sensitive).
strncasecmp() The front n character string comparison (case is not sensitive).
strncmp() The front n character string comparison (case sensitive).
strpbrk() Search any of the specified characters in a string.
strpos() Returns the string in the first place in another string (case sensitive).
strrchr() Find strings in another string last appearance.
strrev() Reverse string.
strripos() Find a string where the last appearance in another string (case is not sensitive).
strrpos() Find a string in the last position in another string (case sensitive).
strspn() Returns the number of specific characters contained in the string.
strstr() Find a string for the first appearance in another string (case sensitive).
strtok() Squate strings into smaller strings.
strtolower() Convert the string to lowercase letters.
strtoupper() Convert the string to uppercase letters.
strtr() Convert a specific character in a string.
substr() Returns part of the string.
substr_compare() Two strings are compared from the specified start position (binary security and selective case case).
substr_count() Calculate the number of times the substring appears in a string.
substr_replace() Replace a part of the string is another string.
trim() Remove blank characters and other characters on both sides of the string.
ucfirst() Convert the first character in the string to uppercase.
ucwords() Convert the first character of each word in the string to uppercase.
vfprintf() Write the formatted string to the specified output stream.
vprintf() Output formatted strings.
vsprintf() Write the formatted string to the variable.
wordwrap() Follow the string according to the specified length.

That's all the String function in PHP, there are more functions here, read it carefully!