PHP Change Case function

Changing Case in PHP

In PHP when we deal with string then change case functions are very important for text manipulation. below we discus each function about changing the text case.
Changing the Case of a Character
Spouse if any one submit some information in string format like that his/her name in small latter but you want to store his/her name in capital latter or title case in which each character of word is capital or any else then you have following function.
for example


<?PHP

$name =' tauqeer shah';

$name = ucwords( $name );

echo $name

}

?>

ucwords( ) function return the text in title case means every character of the each word is capital.
The above Code return name as follow:
Tauqeer Shah
If you want to change only first latter as capital latter then use ucfirst( ) function.


<?PHP

$name =' tauqeer shah';

$name = ucfirst( $name );

echo $name;

?>

This will be return as:
Tauqeer Shah
If you want to convert all the letters in upper then you can use the strtoupper( ) function.


<?PHP

$name =' tauqeer shah';

$name = strtoupper($name );

echo $name;

?>

This will be return as:
TAUQEER SHAH
If you want to convert all the letters in lower then you can use the strtolower( )function.


<?PHP

$name =' tauqeer shah';

$name = strtolower($name );

echo $name;

?>

This will be return as:
tauqeer shah