Hostgre


HomeReferencePHPPHP 5 String Functions

PHP 5 String Functions

PHP 5 String Functions

The PHP string functions are part of the PHP core. No installation is required to use these functions.
FunctionDescription
addcslashes()Return a string with backslashes in front of the specified characters
addslashes()Return a string with backslashes in front of predefined characters
bin2hex()Convert a string of ASCII characters to hexadecimal values
chop()Removes whitespace or other characters from the right end of a string
chr()Return a character from a specified ASCII value
chunk_split()Splits a string into a series of smaller parts
Convert_cyr_string()Convert a string from one Cyrillic character-set to another
Convert_uudecode()Decode a uuencoded string
Convert_uuencode()Encodes a string using the uuencode algorithm
count_chars()Return information about characters used in a string
crc32()Calculate a 32-bit CRC for a string
crypt()One-way string hashing
echo()Outputs one or more strings
explode()Breaks a string into an array
fprintf()Write a formatted string to a specified output stream
get_html_translation_table()Return the translation table used by htmlspecialchars() and htmlentities()
hebrev()Convert Hebrew text to visual text
hebrevc()Convert Hebrew text to visual text and new lines (\n) into <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 from the elements of an array
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 numeric and monetary formatting information
ltrim()Removes whitespace 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 local information
nl2br()Inserts HTML line breaks in front of each newline in a string
number_format()Formats a number with grouped thousands
ord()Return the ASCII value of the first character of a string
parse_str()Parses a query string into variables
print()Outputs one or more strings
printf()Outputs 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 meta characters
rtrim()Removes whitespace or other characters from the right side of a string
setlocale()Sets locale 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 to a variable
sscanf()Parses input from a string according to a format
str_getcsv()Parses a CSV string into an array
str_ireplace()Replace some characters in a string (case-insensitive)
str_pad()Pads a string to a new length
str_repeat()Repeats a string a specified number of times
str_replace()Replace some characters in a string (case-sensitive)
str_rot13()Performs the ROT13 encoding on a string
str_shuffle()Randomly shuffles all characters in a string
str_split()Splits 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 inside another string (alias of strstr())
strcmp()Compare two strings (case-sensitive)
strcoll()Compare two strings (locale based string comparison)
strcspn()Return the number of characters found in a string before any part of some specified characters are found
strip_tags()Strip HTML and PHP tags from a string
stripcslashes()UnQuote a string quoted with addcslashes()
Striplashes()UnQuote a string quoted with addslashes()
stripos()Return the position of the first occurrence of a string inside another string (case-insensitive)
stristr()Find the first occurrence of a string inside another string (case-insensitive)
strlen()Return 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()Searches a string for any of a set of characters
strpos()Return the position of the first occurrence of a string inside another string (case-sensitive)
strrchr()Find the last occurrence of a string inside another string
strrev()Reverses a string
strripos()Find the position of the last occurrence of a string inside another string (case-insensitive)
strrpos()Find the position of the last occurrence of a string inside another string (case-sensitive)
strspn()Return the number of characters found in a string that contains only characters from a specified charlist
strstr()Find the first occurrence of a string inside another string (case-sensitive)
strtok()Splits a string into smaller strings
strtolower()Convert a string to lowercase letters
strtoupper()Convert a string to uppercase letters
strtr()Translate certain characters in a string
substr()Return a part of a string
substr_compare()Compare two strings from a specified start position (binary safe and optionally case-sensitive)
substr_count()Count the number of times a substring occurs in a string
substr_replace()Replace a part of a string with another string
trim()Removes whitespace or 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()Outputs a formatted string
vsprintf()Write a formatted string to a variable
wordwrap()Wraps a string to a given number of characters