Introduction
I am describing changing string case in PHP. For that I am describing one by one the important string() functions strtolower(), strtoupper(), ucfirst() and ucwords().
First I am discussing the Strtolower() function in PHP. The "Strtolower()" function is a string function. This function converts string uppercase to lowercase.
Syntax
|
strtolower(string, $str); |
Example
<?php
$str = "Hii.. Sharad, How are you?";
$str = strtolower($str);
echo $str;
?>
Output

The "Strtoupper()" function is a string function. This function converts a lowercase string to uppercase.
Syntax
|
strtoupper(string, $str); |
Example
<?php
$str = "Hii.. Sharad, How are you?";
$str = strtoupper($str);
echo $str;
?>
Output

The "Ucfirst()" function is a string function. This function converts the first character of a string to lower case. For example your first character is lower case so the ucfirst function converts it to a capital letter. For example, I am using the string "hello sir".
Syntax
|
Ucfirst(string, $str); |
Example
<?php
$string1 = 'hello ram!';


Join the conversation! Your thoughts help the community grow.