PHP string functions are used to manipulate string data. The most common string functions include the following:
PHP String Function | Description |
addslashes() | Adds slashes to specified characters in a string. |
echo() | Outputs one or more strings. |
explode() | Splits a string into multiple strings based on the specified delimiter. |
htmlentities() | Converts characters into corresponding HTML entities. |
htmlspecialchars() | Converts 5 characters into corresponding HTML entities. |
implode() | Joins array elements with a specified delimiter. |
md5() | Calculates the md5 hash of a string. |
number_format() | Sets the format of a numerical output. |
print() | Outputs one or more strings. |
str_replace() | Changes certain occurrances on a string with a replacement string. |
strlen() | Returns the length of a string. |
strpos() | Finds the position of the first match in a string. |
strstr() | Returns all characters of a string after the first match. |
substr() | Retrieves a portion of the string. |
trim() | Strips out white spaces at both ends of a string. |