PHP 8 reference · Multibyte String Functions
PHP mb_strtolower() Function
Convert a string to lowercase, including letters outside ASCII such as É, Ü and Cyrillic. The Unicode-aware strtolower().
PHP 8 Since 4.3
Syntax
mb_strtolower(string $string, ?string $encoding = null): string
Parameters
| Parameter | Description |
|---|---|
string |
The input string. |
encoding optional |
The character encoding; defaults to mb_internal_encoding() (UTF-8). |
Return value
The lowercased string.
Examples
<?php
echo strtolower("ÉCOLE"), "\n";
echo mb_strtolower("ÉCOLE"), "\n";
Output
École école
<?php
echo mb_strtolower("ΑΘΗΝΑ"), "\n";
// lowercasing keeps ß, so use MB_CASE_FOLD to compare these
var_dump(mb_strtolower("Straße") === mb_strtolower("STRASSE"));
Output
αθηνα bool(false)
Version history
| Version | Change |
|---|---|
| PHP 4.3 | Added |
In other languages
str.lower()· Pythonstring.toLowerCase()· JavaScript
Related
strtolower()· Convert every ASCII letter in a string to lowercase. Since PHP 8.2 it ignores the locale; use mb_strtolower() for é, Ü and others.mb_strtoupper()· Convert a string to uppercase, including letters outside ASCII such as é, ß and Cyrillic. The Unicode-aware strtoupper().mb_convert_case()· Change the case of a string with Unicode rules: upper, lower, title case or case folding for comparisons.- PHP Strings · tutorial