The strtolower() function is used to convert a string into lowercase. This function takes a string as parameter and converts all the uppercase english alphabets present in the string to lowercase. All other numeric characters or special characters in the string remains unchanged.
Syntax:
string strtolower( $string )
Parameters: The only parameter to this function is a string that is to be converted to lower case.
Return value: This function returns a string in which all the alphabets are lower case.
Examples:
Input : $str = "GeeksForGeeks"
strtolower($str)
Output: geeksforgeeks
Input : $str = "going BACK he SAW THIS 123$#%"
strtolower($str)
Output: going back he saw this 123$#%
Below programs illustrate the strtolower() function in PHP:
Program 1:
<?php
$str = "GeeksForGeeks" ;
$resStr = strtolower ( $str );
print_r( $resStr );
?>
|
Output:
geeksforgeeks
Program 2:
<?php
$str = "going BACK he SAW THIS 123$#%" ;
$resStr = strtolower ( $str );
print_r( $resStr );
?>
|
Output:
going back he saw this 123$#%
PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
20 Nov, 2023
Like Article
Save Article