To convert a string to all lowercase, use strtolower().
This function takes a string, and returns a converted copy of the string:
<?php $myString = "Hello, world!"; echo strtolower( $myString ); // Displays'hello, world!' ?>//from w w w. j av a 2s . co m
You can use strtoupper() to convert a string to all uppercase:
<?php $myString = "Hello, world!"; echo strtoupper( $myString ); // Displays'HELLO, WORLD!' ?>//from w ww . ja v a 2 s.co m ucfirst() makes just the first letter of a string uppercase:
<?php $myString = "hello, world!"; echo ucfirst( $myString ); // Displays'Hello, world!' ?>/*from w w w . ja v a2 s. c o m*/
lcfirst() makes the first letter of a string lowercase:
<?php $myString = "Hello, World!"; echo lcfirst( $myString ); // Displays'hello, World!' ?>/* ww w .j av a 2 s . c o m*/
Finally, ucwords() makes the first letter of each word in a string uppercase:
<?php $myString = "hello, world!"; echo ucwords( $myString ); // Displays'Hello, World!' ?>/* w w w .j a va 2s . co m*/