To convert a string to lowercase in PHP, you can use the strtolower()
function. This function converts all the characters of a string to lowercase, and returns the modified string.
For example:
$string = 'HELLO';
$string = strtolower($string);
// $string will be equal to 'hello'
You can also use the mb_strtolower()
function to convert a multibyte string to lowercase. This function requires the mbstring
extension to be enabled in your PHP configuration.
For example:
$string = 'HÉLLO';
$string = mb_strtolower($string, 'UTF-8');
// $string will be equal to 'héllo'