PHP 8 reference · String Functions
PHP strtolower() Function
Convert every ASCII letter in a string to lowercase. Since PHP 8.2 it ignores the locale; use mb_strtolower() for é, Ü and others.
PHP 8 Since 4.0
Syntax
strtolower(string $string): string
Parameters
| Parameter | Description |
|---|---|
string |
The input string. |
Return value
The lowercased string.
Examples
<?php
echo strtolower("Hello World"), "\n";
echo strtolower("[email protected]"), "\n";
Output
hello world [email protected]
<?php
$answer = "YES";
if (strtolower($answer) === "yes") {
echo "Confirmed\n";
}
Output
Confirmed
Version history
In other languages
str.lower()· Pythonstring.toLowerCase()· JavaScript
Related
strtoupper()· Convert every ASCII letter in a string to uppercase. Letters such as é stay unchanged; use mb_strtoupper() for those.mb_strtolower()· Convert a string to lowercase, including letters outside ASCII such as É, Ü and Cyrillic. The Unicode-aware strtolower().ucfirst()· Make the first character of a string uppercase and leave the rest as it is. Only ASCII letters change.strcasecmp()· Compare two strings without caring about ASCII upper and lower case. Returns 0 if they match.- PHP Strings · tutorial