Is there any function in PHP to make the first character of the word uppercase, or should I write it with a regular expression?
Use the ucfirst function .
$word = ucfirst($word);
$firstlettersuppercased = ucwords($originalstring);
firstlettersuppercased = ucwords($originalstring);
This will use the first letter of each word in the original string $.
$word_ = "your name here"; echo ucfirst($word_); // Your name here echo ucwords($word_); // Your Name Here
Try using the function ucwords().
ucwords()