This document lists and describes 16 basic string functions in PHP including functions to find the length, reverse, replace parts of, uppercase, lowercase, repeat, compare, extract parts of, trim, and explode strings as well as find characters from ASCII values.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
95 views
PHP Basic String Functions
This document lists and describes 16 basic string functions in PHP including functions to find the length, reverse, replace parts of, uppercase, lowercase, repeat, compare, extract parts of, trim, and explode strings as well as find characters from ASCII values.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
PHP Basic String Functions
1. Strlen(string) – to find length of string
2. Str_word_count(string) – to display no of words in given string 3. Strrev(string) – to find reverse of string 4. Strpos(string,text) – to find particular text within a string 5. Str_replace(string to be replaced, text, string) – used to replace specific text within a string 6. Ucfirst(string) – converts the first letter of string to uppercase 7. Lcfirst(string) – converts the first letter of string to lowercase 8. Ucwords(string) – to convert the string to title case 9. Strtoupper(string) – to convert the string into uppercase 10. Strtolower(string) – to convert the string into lowercase 11. Str_repeat(string,repeat) – to repeat a string a number of times 12. Strcmp(string1,string2) – to compare two strings. Same as c language 13. Substr(string , start, length) – to extract a part of string from it. 14. Trim(string,charlist) – to remove whitespaces and specified characters from both sides of string 15. Explode(string) – used to convert string into array variable 16. Chr(ascii) – to find character from given ascii value