PHP strtolower() Function
The strtolower() function converts all alphabetic characters in a string to lowercase.
Syntax
strtolower(string $string): string
Parameters
| Parameter | Type | Description |
|---|---|---|
$string | string | The input string |
Return Value
Returns the string with all alphabetic characters converted to lowercase.
Try It Online
Output
Click Run to execute your code
More Examples
Case-Insensitive Comparison
<?php
$input = "YES";
if (strtolower($input) === "yes") {
echo "User agreed!";
}
?>
Email Normalization
<?php
$email = "[email protected]";
$normalized = strtolower($email);
echo $normalized; // "[email protected]"
?>
Note: For UTF-8 strings with special characters, use
mb_strtolower() instead.
Common Use Cases
- Case-insensitive string comparisons
- Email normalization
- URL slug generation
- Username validation
Related Functions
- strtoupper() - Convert to uppercase
ucfirst()- Capitalize first letterucwords()- Capitalize each wordmb_strtolower()- UTF-8 safe version
Enjoying these tutorials?