Converting the first letter to upper case of each word

$output=ucwords($input_str [,string $delimiters]);
$input_strRequired : Input string
$delimitersOptional : contains the word separator characters.
We can use php string function ucwords to change all first character of each words present in a string to upper case

Now let us try with one example

Here is a string variable $str with one string inside it. We will use ucwords() to capitalize first chars of every words inside it.
$str="welcome to you can learn web programming here";
echo $str;
The output is here
Welcome To You Can Learn Web Programming Here

With delimiters

Here we have used , as word delimiters
echo ucwords($my_str,',');
Output is here
Now we will use | as delimiters
echo ucwords($my_str,'|');
Output is here
Using both , and | as delimiters
echo ucwords($my_str,'|,');
Output is here


Output :

Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net

    PHP String Functions

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2023 All rights reserved worldwide Privacy Policy Disclaimer