The mb_strtolower Function
The mb_strtolower function converts all characters in a string to lowercase,
considering the features of multibyte encodings. It accepts a string as the first parameter,
and an encoding as the second (optional) one. If the encoding is not specified, the script's internal encoding is used.
Syntax
mb_strtolower(string, [encoding]);
Example
Let's convert a string with Cyrillic characters to lowercase:
<?php
echo mb_strtolower('Привет МИР');
?>
Code execution result:
'привет мир'
Example
Convert a string specifying the UTF-8 encoding:
<?php
echo mb_strtolower('HELLO WORLD', 'UTF-8');
?>
Code execution result:
'hello world'
Example
Comparison with the regular strtolower for multibyte strings:
<?php
$str = 'Привет Мир';
echo strtolower($str) . '<br>';
echo mb_strtolower($str, 'UTF-8');
?>
Code execution result:
'Привет Мир'
'привет мир'
See Also
-
the
mb_strtoupperfunction,
which converts a string to uppercase -
the
strtolowerfunction,
which converts a string to lowercase