PHP ucwords() Function for first capital letter of each word- developersmap.com
The ucwords() is an in-built function of PHP, which is used to convert the first character of each word to uppercase in a string. The ucwords() is supported by the PHP 4 and above versions. It takes a string as an input and converts the first character of each word of the string to uppercase. The other characters of the string remain the same.
<?php $input_str = "hello, my name is lovyansh."; echo ucwords($input_str); ?>
Hello, My Name Is Lovyansh.