PHP 5 String Functions
- Previous Page PHP SimpleXML
- Next Page PHP XML
PHP 5 String Functions
PHP string functions are an integral part of PHP's core. These functions can be used without installation.
Function | Description |
---|---|
addcslashes() | Return the string with backslashes added before specified characters. |
addslashes() | Return the string with backslashes added before predefined characters. |
bin2hex() | Convert a string of ASCII characters to a hexadecimal value. |
chop() | Remove whitespace characters or other characters from the right side of the string. |
chr() | Return the character from the specified ASCII value. |
chunk_split() | Split the string into a series of smaller parts. |
convert_cyr_string() | Convert the string from one Cyrillic character set to another. |
convert_uudecode() | Decode the uuencode encoded string. |
convert_uuencode() | Encode the string using the uuencode algorithm. |
count_chars() | Return information about the characters used in the string. |
crc32() | Calculate the 32-bit CRC of the string. |
crypt() | One-way string encryption method (hashing). |
echo() | Output one or more strings. |
explode() | Split the string into an array. |
fprintf() | Write the formatted string to the specified output stream. |
get_html_translation_table() | Return the translation table used by htmlspecialchars() and htmlentities(). |
hebrev() | Convert Hebrew text to visible text. |
hebrevc() | Convert Hebrew text to visible text and replace new lines (\n) with <br>. |
hex2bin() | Convert a string of hexadecimal values to ASCII characters. |
html_entity_decode() | Convert HTML entities to characters. |
htmlentities() | Convert characters to HTML entities. |
htmlspecialchars_decode() | Convert some predefined HTML entities to characters. |
htmlspecialchars() | Convert some predefined characters to HTML entities. |
implode() | Return a string composed of array elements. |
join() | Alias of implode(). |
lcfirst() | Convert the first character of a string to lowercase. |
levenshtein() | Return the Levenshtein distance between two strings. |
localeconv() | Return locale-specific number and currency format information. |
ltrim() | Remove whitespace characters or other characters from the left side of a string. |
md5() | Calculate the MD5 hash of a string. |
md5_file() | Calculate the MD5 hash of a file. |
metaphone() | Calculate the metaphone key of a string. |
money_format() | Return a string formatted as a currency string. |
nl_langinfo() | Return specific locale information. |
nl2br() | Insert HTML line breaks before each new line in a string. |
number_format() | Format numbers by grouping in thousands. |
ord() | Return the ASCII value of the first character in a string. |
parse_str() | Parse the query string into variables. |
print() | Output one or more strings. |
printf() | Output a formatted string. |
quoted_printable_decode() | Convert a quoted-printable string to an 8-bit string. |
quoted_printable_encode() | Convert an 8-bit string to a quoted-printable string. |
quotemeta() | Quote metacharacters. |
rtrim() | Remove whitespace characters or other characters from the right side of a string. |
setlocale() | Set the locale information (geographical information). |
sha1() | Calculate the SHA-1 hash of a string. |
sha1_file() | Calculate the SHA-1 hash of a file. |
similar_text() | Calculate the similarity between two strings. |
soundex() | Calculate the soundex key of a string. |
sprintf() | Write a formatted string into variables. |
sscanf() | Parse input from a string according to a specified format. |
str_getcsv() | Parse a CSV string into an array. |
str_ireplace() | Replace some characters in a string (case-insensitive). |
str_pad() | Pad a string to a new length. |
str_repeat() | Repeat a string a specified number of times. |
str_replace() | Replace some characters in a string (case-sensitive). |
str_rot13() | Perform ROT13 encoding on a string. |
str_shuffle() | Randomly shuffle all characters in a string. |
str_split() | Split a string into an array. |
str_word_count() | Count the number of words in a string. |
strcasecmp() | Compare two strings (case-insensitive). |
strchr() | Find the first occurrence of a string in another string. (Alias of strstr().) |
strcmp() | Compare two strings (case-sensitive). |
strcoll() | Compare two strings (based on the local settings). |
strcspn() | Return the number of characters found before finding any of the specified characters in the string. |
strip_tags() | Strip HTML and PHP tags from a string. |
stripcslashes() | Remove backslashes added by the addcslashes() function. |
stripslashes() | Remove backslashes added by the addslashes() function. |
stripos() | Returns the position of the first occurrence of a string in another string (case-insensitive). |
stristr() | Find the first occurrence of a string in another string (case-insensitive). |
strlen() | Returns the length of a string. |
strnatcasecmp() | Compare two strings using a 'natural order' algorithm (case-insensitive). |
strnatcmp() | Compare two strings using a 'natural order' algorithm (case-sensitive). |
strncasecmp() | String comparison of the first n characters (case-insensitive). |
strncmp() | String comparison of the first n characters (case-sensitive). |
strpbrk() | Find any character of a set of characters in a string. |
strpos() | Returns the position of the first occurrence of a substring in another string (case-sensitive). |
strrchr() | Find the last occurrence of a string in another string. |
strrev() | Reverse a string. |
strripos() | Find the last occurrence of a string in another string (case-insensitive). |
strrpos() | Find the last occurrence of a string in another string (case-sensitive). |
strspn() | Return the number of occurrences of a specific character in a string. |
strstr() | Find the first occurrence of a string in another string (case-sensitive). |
strtok() | Split a string into smaller strings. |
strtolower() | Convert a string to lowercase letters. |
strtoupper() | Convert a string to uppercase letters. |
strtr() | Convert specific characters in a string. |
substr() | Return a part of a string. |
substr_compare() | Compare two strings from a specified starting position (binary safe and case-sensitive). |
substr_count() | Count the number of occurrences of a substring in a string. |
substr_replace() | Replace a part of a string with another string. |
trim() | Remove whitespace characters and other characters from both sides of a string. |
ucfirst() | Convert the first character of a string to uppercase. |
ucwords() | Convert the first character of each word in a string to uppercase. |
vfprintf() | Write a formatted string to a specified output stream. |
vprintf() | Output a formatted string. |
vsprintf() | Write a formatted string into a variable. |
wordwrap() | Split a string into specified number of substrings |
- Previous Page PHP SimpleXML
- Next Page PHP XML