Php String Functions


The string functions allow you to manipulate strings. the string functions are part of the PHP core. there is no installation needed to use these functions.
Function Descrption
chr() The chr() function returns a character from the specified ASCII value.
ord() The ord() function returns the ASCII value of the first character of a string.
strtolower() The strtolower() function converts a string to lowercase.
strtoupper() The strtoupper() function converts a string to uppercase.
strlen() The strlen() function returns the length of a string.
ltrim() The ltrim() function will remove whitespaces or other predefined character from the left side of a string.
rtrim() The rtrim() function will remove whitespaces or other predefined character from the right side of a string.
trim() The trim() function will remove whitespaces or other predefined character from the both sides of a string.
ucfirst() The ucfirst() function convert the first character of a string uppercase.
ucwords() The ucfirst() function convert the first character of a word in a string to uppercase.
substr() The substr() function returns a part of a string.
strcmp() The strcmp() function compares two strings.
strcasecmp() The strcasecmp() function compares two strings. the strcasecmp() function is binary safe and case-insensitive.
strpos() The strpos() function returns the position of the first occurrence of a string inside another string. if the string is not found, this function returns false.
strrpos() The strrpos() function finds the position of the last occurrence of a string inside another string. this function returns the position on success, otherwise it returns false.
strstr() The strstr() function searches for the first occurrence of a string inside another string. this function returns the rest of the string(from the mathin point), or false, if the string to search for is not found. this function is case-sensitive.
stristr() The stristr() function searches for the first occurrence of a string inside another string. this function returns the rest of the string(from the mathin point), or false, if the string to search for is not found. this function is case-insensitive.
str_replace() The str_replace() function replaces some character with some other characters in a string. this funcion case-sensitive.
strrev() The strrev() function returns the reverse a string.
echo() The echo() function outputs one or more strings. the echo() function is slightly faster than print()
print() The print() function ou tputs one or more string. the print() function is slightly slower than echo().