| |
|
Converting the first letter to upper case of every word |
We can use php string function ucwords to change all first character of words present in a string to upper case or capitalize the first letter of each word.
Here is the syntax
$output=ucwords($input_str);
You can see the output string is $output and input string is $input_str in the above example.
Now let us try with one example
Here is a string variable $str with some string inside it. We will use ucwords to capitalize first chars of every words inside it.
$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
You can read how to change all the letters to upper case here
| |
| Subscribe |
|
Submit your email address and receive
article and product notifications. Your email is safe with us.
|
|
|
|
|
|