I am using PHP to insert records into a MySQL database. Sometimes users enter text in all caps. Is there a way to change it so that only the first letters are capitalized? ucwords(strtolower($word))will not work for me because I don’t want to capitalize the first letter, if it is not capitalized yet.
My main problem is when people submit their surnames. Most people serve it right, but some serve it like all caps. If these are all caps, he should work the same way ucwords(strtolower($word)), but if someone gives his name as De La Rosa, I would not want him to change to De La Rosa.
source
share