Changing Case (Uppercase to lowercase or inverse) using php

PHP provides functionality for changing the case of a string to all uppercase, all lowercase, or the first letter of a word to uppercase. The commands are strtoupper, strtolower, and ucwords, respectively.

Using the word case functions

");
echo("$username in lower case is ".strtolower($username).".
");
echo("$username in first letter upper case is ".ucwords($username).".
");
?>

The above code returns:

John Doe in upper case is JOHN DOE.
John Doe in lower case is john doe.
John Doe in first letter upper case is John Doe.

Share This Post

Post Comment