How to make the first letter of the word capital?

I have the word default , and I want the php function to create only the first letter capital. We can do this. Please help me as I am very new to php coding.

+7
source share
5 answers

You can use ucfirst () .

For multibyte strings, see this snippet .

+16
source

ucfirst capital letters of the first letter in a string.

ucwords are the capital letters of each word in a string.

+5
source

Hello Gieta, you can simply use the ucwords() php function to make every first letter of the word Upper Cased!

Hope this helps!

+2
source

I think http://se2.php.net/manual/en/function.ucwords.php is the best feature here :)

+2
source

This is the code you need:

 <?php $string = 'stackoverflow'; $string = ucfirst($string); echo $string; ?> 
+1
source

All Articles