PHP String Functions List
Here’s a list of common string functions in PHP:
strlen() - Returns the length of a string.
str_word_count() - Counts the number of words in a string.
strpos() - Finds the position of the first occurrence of a substring.
str_replace() - Replaces some characters in a string.
substr() - Returns part of a string.
trim() - Removes whitespace or other characters from the beginning and end of a string.
strtolower() - Converts a string to lowercase.
strtoupper() - Converts a string to uppercase.
ucfirst() - Capitalizes the first letter of a string.
lcfirst() - Converts the first letter of a string to lowercase.
ucwords() - Capitalizes the first letter of each word in a string.
md5() - Calculates the MD5 hash of a string.
sha1() - Calculates the SHA-1 hash of a string.
addslashes() - Escapes a string with backslashes.
htmlspecialchars() - Converts special characters to HTML entities.
str_repeat() - Repeats a string a specified number of times.
explode() - Splits a string by a string and returns an array.
implode() (alias of join()) - Joins array elements with a string.
strrev() - Reverses a string.
similar_text() - Calculates the similarity between two strings.
number_format() - Formats a number with grouped thousands.
ord() - Returns the ASCII value of the first character of a string.
chr() - Returns a character from a specified ASCII value.
parse_str() - Parses a query string into variables.
sprintf() - Returns a formatted string.
These functions are widely used for string manipulation in PHP. Let me know if you need examples or explanations for any specific ones!