Hello Friends Today, through this tutorial, I will tell you how do you capitalize the first letter of each word in a string in PHP With Example? You can capitalize the first letter of each word in a string in PHP using the `ucwords()` function. Here’s an example:
<?php $string = "capitalize the first letter of each word"; $capitalizedString = ucwords($string); echo $capitalizedString; // Output: Capitalize The First Letter Of Each Word ?>
This function takes a string as input and returns a new string with the first letter of each word capitalized.