In order to take care of new PHP friends, this chapter will share with you the most basic knowledge: PHP How to convert the case, we will use the example to explain.
Strtoupper ()
Capitalize all letters
Strtolower ()
All Letters lowercase
Ucwords ()
The first letter of each word is converted to uppercase
Ucfirst ()
Capitalize the first letter of the initial word
Lcfirst ()
The first word gets lowercase
Example:
$foo = ' Hello world! '; $foo = Ucwords ($foo); Hello world! $bar = ' HELLO world! '; $bar = Ucwords ($bar); HELLO world! $bar = Ucwords (Strtolower ($bar)); Hello world! $foo = ' Hello world! '; $foo = Ucfirst ($foo); Hello world! $bar = ' HELLO world! '; $bar = Ucfirst ($bar); HELLO world! $bar = Ucfirst (Strtolower ($bar)); Hello world! $foo = ' HelloWorld '; $foo = Lcfirst ($foo); HelloWorld $bar = ' HELLO world! '; $bar = Lcfirst ($bar); HELLO world! $bar = Lcfirst (Strtoupper ($bar)); HELLO world!
The above is the PHP conversion case of the details, I hope the net is helpful to everyone.