convert string to lowercase or upper case in php

by rajesh 2010-01-03 14:46:48

To convert all the characters in a string to lower case (lowercase):

strtolower($string) — This function makes a string lowercase

Example

$str = "LOWERCASE as lower case";
$str = strtolower($str);
echo $str; // Prints "lowercase as lower case"
?>



To convert all the characters in a string to upper case (uppercase):

strtoupper($string) — This function makes a string upper case

Example

$str = "uppercase as UPPER CASE";
$str = strtolower($str);
echo $str; // Prints "UPPERCASE AS UPPER CASE"
?>



more functions
# ucfirst() - Make a string's first character uppercase
# ucwords() - Uppercase the first character of each word in a string

Tagged in:

1081
like
0
dislike
0
mail
flag

You must LOGIN to add comments