- PHP

How to convert text to Lowercase in PHP

Use strtolower() or mb_strtolower functions. In most cases I recommend the second one, hence it works with more characters such as ó, ä, etc.

strtolower($string);
mb_strtolower($string);

Examples:

<?php

$text1 = 'Hello world';
$text2 = 'Żaba';

echo strtolower($text1) . '<br>'; // Output: hello world
echo mb_strtolower($text1) . '<br>'; // Output: hello world
echo strtolower($text2) . '<br>'; // Output: Żaba (it didn't work because of "Ż" letter)
echo mb_strtolower($text2) . '<br>'; // Output: żaba (it did wor, because mb_strtolower supports "Ż" letter)

?>