Thursday, 25 September 2014

string functions in PHP

FunctionDescription
addcslashes adds backslashes in front of the specified characters and returns the string
addslashes adds backslashes in front of predefined characters and returns string
bin2hex a string of ASCII characters is converted to hexadecimal values
chop alias to rtrim()
chr converts a specified ASCII value to character and returns it
chunk-split specified string is divided into a series of smaller parts
convert-cyr-string one Cyrillic character-set from specified string is converted to another
convert-uudecode a uuencoded string is decoded
convert-uuencode using the uuencode algorithm, a specified string is encoded
count-chars returns the count of an ASCII character occurrence within a specified string and returns the information
crc32 a 32-bit CRC is calculated for a specified string
crypt string is encrypted in one-way (hashing)
echo prints string
explode returns an array formed from a specified string
fprintf allows to write a formatted string to a specified output stream
get-html-translation-table returns the translation table used by htmlspecialchars() and htmlentities()
hebrev Hebrew text is converted to visual text
hebrevc Hebrew text is converted to visual text and also new lines (\n) are converted to <br />
html-entity-decode HTML entities are converted to characters
htmlentities characters are converted to HTML entities
htmlspecialchars-decode some predefined HTML entities are converted to characters
htmlspecialchars some predefined characters are converted to HTML entities
implode returns a string formed from the elements of an array
join alias to implode()
levenshtein calculates the Levenshtein distance between two strings and returns
ltrim whitespace from the left side of a specified string is striped
md5 returns the calculated MD5 hash of a specified string
md5-file returns the calculated MD5 hash of a specified file
metaphone returns a calculated metaphone key of a specified string
nl2br adds HTML line breaks (\n) in front of each newline in a specified string
number-format returns a formatted number with grouped thousands
ord calculates the ASCII value of the first character of a specified string and returns
parse-str a query string is parsed into variables and returned
print prints a string
printfprints a formatted string
quoted-printable-decode returns a decoded string from quoted-printable string
quotemeta quotes meta characters from specified string and returns
rtrim whitespace from the right side of a specified string is striped
setlocale locale information is set
sha1 returns a calculated SHA-1 hash of a specified string
sha1-file returns a calculated SHA-1 hash of a specified file
similar-text returns the calculated similarity between two specified strings
soundex returns a calculated soundex key of a specified string
sprintf writes a formatted string to a variable
sscanf Parses input from a string according to a format
str-ireplace returns a string by replacing some characters in a specified string (case-insensitive)
str-pad returns a string by padding a specified string to a new length
str-repeat returns a string by repeating a specified string for a specified number of times
str-replace returns a string by replacing some characters in a specified string (case-sensitive)
str-rot13 returns a calculated ROT13 encoded of a specified string
str-shuffle returns a string by Randomly shuffling all characters in a specified string
str-split returns an array by splitting a specified string into an array
str-word-count calculates the number of words in a specified string and returns
strcasecmp returns the comparison of two specified strings (case-insensitive)
strchr finds the first occurrence of a string inside another string (alias of strstr()) and returns the rest of the string
strcmp returns the comparison of two specified strings (case-sensitive)
strcoll returns the result of locale based string comparison
strcspn Returns the number of characters found in a string before any part of some specified characters are found
strip-tags returns a string by removing HTML and PHP tags from a specified string
stripcslashes returns a string by removing backslashes added by the addcslashes() function
stripslashes returns a string by removing backslashes added by the addslashes() function
stripos calculates the position of first occurrence of a string inside another string and returns it (case-insensitive)
stristr calculates the first occurrence of a string inside another string (case-insensitive)
strlen calculates the length of a string and returns
strnatcasecmp returns the comparison of two strings using a "natural order" algorithm (case-insensitive)
strnatcmp returns the comparison of two strings using a "natural order" algorithm (case-sensitive)
strncasecmp returns the result of string comparison of the first n characters (case-insensitive)
strncmp returns the result of string comparison of the first n characters (case-sensitive)
strpbrk searches a string for any of a set of characters and returns the rest of string
strpos calculates the position of first occurrence of a string inside another string and returns it(case-sensitive)
strrchr calculates the last occurrence of a string inside another string
strrev returns a string after reversing
strripos calculates the position of the last occurrence of a string inside another string and returns it(case-insensitive)
strrpos calculates the position of the last occurrence of a string inside another string and returns it(case-sensitive)
strspn returns the number of characters found in a string that contains only characters from a specified charlist
strstr calculates the first occurrence of a string inside another string and returns it(case-sensitive)
strtok divides a string into smaller strings and returns it
strtolower returns a string after converting to lowercase letters
strtoupper returns a string after converting to uppercase letters
strtr returns a string after translating certain characters in a specified string
substr returns a specified part of a string
substr-compare returns a result of comparison of two strings from a specified start position (binary safe and optionally case-sensitive)
substr-count returns the count of number of times a substring occurs in a string
substr-replace returns a modified string after replacing a part of a specified string with another specified string
trim returns a string after removing whitespace from both sides of a specified string
ucfirst returns a string after changing a first character of a specified string to uppercase
ucwords returns a string after changing the first character of each word in a specified string to uppercase
vfprintf writes a formatted string to a specified stream
vprintf prints a formatted string
vsprintf returns a formatted string
wordwrap wraps a string to a given number of characters

0 comments:

Post a Comment