The ucfirst() function is used to change the first character of a string to uppercase. Otherwise, We can use the strtolower() function in combination with the ucfirst() function, if you need to make only first letter of the string to uppercase and rest of the string to lowercase.
Syntax
string – This parameter is required. It converts the first character of a string to uppercase.
Example
<?php
$str = 'php tutorials!';
echo ucfirst($str); // Php tutorials!
echo "<br>";
$str1 = 'PHP Tutorials!';
echo ucfirst($str1); // PHP Tutorials!
echo "<br>";
echo ucfirst(strtolower($str1)); // Php tutorials!
?>
About Praveen Kumar
I am a fullstack web developer with a passion for SEO, creating stunning websites, and organic marketing. I am a perfectionist.
View all posts by Praveen Kumar