xxxxxxxxxx
<?php
$foo = 'hello world!';
$foo = ucfirst($foo); // Hello world!
$bar = 'HELLO WORLD!';
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!
?>
xxxxxxxxxx
ucwords("hello world"); // Hello World
ucfirst("hello world"); // Hello world
xxxxxxxxxx
$clientname = "ankur prajapati";
ucwords($clientname);//Ankur Prajapati
ucfirst($clientname);//Ankur Prajapati
$clientname = "ANKUR PRAJAPATI";
ucfirst(strtolower($clientname));//Ankur Prajapati
xxxxxxxxxx
<?php
// Function to capitalize the first letter of a string
function capitalizeFirstLetter($str) {
return ucfirst($str);
}
// Example usage
$myString = "hello world";
$capitalizedString = capitalizeFirstLetter($myString);
echo $capitalizedString; // Output: "Hello world"
?>