Converts the first letter of each word to uppercase: Ucwords ()
Capitalize the first letter of a word: Ucfirst ()
First letter to lowercase: lcfirst ()
Capitalize all letters: Strtoupper ()
Example
The code is as follows |
Copy Code |
<?php Echo strtoupper ("Hello world!"); ?> Output: HELLO world! |
Capitalize the first letter of a word: Ucfirst ()
The code is as follows |
Copy Code |
<?php $foo = ' where are doing?! '; $foo = Ucfirst ($foo); Where are doing?! $bar = ' where are doing?! '; $bar = Ucfirst ($bar); Where are doing?! $bar = Ucfirst (Strtolower ($bar)); Where are doing?! ?> |
All letters to lowercase: strtolower ()
The code is as follows |
Copy Code |
<?php $str = "Mary Had A Little Lamb and She loved It so"; $str = Strtolower ($STR); Echo $str; Prints Mary had a little lamb and she loved it so ?> |
Converts the first letter of each word to uppercase: Ucwords ()
The code is as follows |
Copy Code |
<?php $foo = ' where are doing?! '; $foo = Ucwords ($foo); Where are doing?! $bar = ' where are doing?! '; $bar = Ucwords ($bar); Where are doing?! $bar = Ucwords (Strtolower ($bar)); Where are doing?! ?> |
First letter to lowercase: lcfirst ()
code is as follows |
copy code |
<?php $foo = ' HelloWorld '; $foo = Lcfirst ($foo); //Where are doing $bar = ' where are doing?! '; $bar = Lcfirst ($bar); //Where are doing ?! $bar = Lcfirst (Strtoupper ($bar));//Where are doing?! ? |