I need code for replace into string all characters in lowercase and the first character of the string in uppercase using php regular expression. Example: string "tHIS is The TEST" to "This is the test"
Use the built in functions.
strtolower and then ucfirst.
Curious though :
What if there is a name in your string?
Example : "HeLLo tHere DonAld."
This would become : "Hello there donald." The d in donald needs to be capitalized as well.
ucfirst(strtolower($string))