ucwords() :Converting the first letter to upper case of each word
$str="welcome to plus2net.com. you can learn web programming here";
$str=ucwords($str);
echo $str;
The output is here
Welcome To Plus2net.com. You Can Learn Web Programming Here
Syntax
$output=ucwords($input_str [,string $delimiters]);
Parameter | DESCRIPTION |
$input_str | Required : Input string |
$delimiters | Optional : contains the word separator characters. |
With delimiters
Here we have used , as word delimiters
$my_str="hello,welcome";
echo ucwords($my_str,',');
Output is here
Hello,Welcome
Now we will use | as delimiters
$my_str="hello,welcome|home";
echo ucwords($my_str,'|');
Output is here
Hello,welcome|Home
Using both , and | as delimiters
$my_str="hello,welcome|home";
echo ucwords($my_str,'|,');
Output is here
Hello,Welcome|Home
DEMO
← String Functions ucfirst(): To Change first char only to upper case of a string. →
how to change all the letters to upper case →
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com