How do I convert string to lowercase in PHP?

To convert a string to lowercase in PHP, you can use the strtolower(string) function. The strtolower() function takes a string as a parameter and converts all uppercase letters of the English alphabet present in the string to lowercase. To convert non-English characters to lowercase, you can use the mb_strtolower() function instead. All other numeric characters or special characters in the string are left unchanged. In this PHP convert a string into a lowercase example, we are converting a string to lowercase using the strtolower() function. Click Execute to run the PHP Lowercase String Example online and see the result.
How do I convert string to lowercase in PHP? Execute
<?php
echo strtolower('Hello World!');
?>
Updated: Viewed: 1125 times

How to make PHP string lowercase?

To make a PHP string lowercase, use the strtolower() function, which converts the string to lowercase. The function returns a string with all letters in lowercase.

PHP strtolower() Syntax
strtolower(string)

Where:
  • string: specifies the string to be converted to lowercase
PHP String to Lowercase Example
<?php
echo strtolower('Hello World!');
?>

#output: hello world!

How to convert non-English characters to lowercase in PHP?

To convert non-English characters to lowercase, you can use the mb_strtolower() function:

PHP non-English String to Lowercase Example
<?php
echo mb_strtolower('ԲԱՐԵՒ ԱՇԽԱՐՀ!');
?>

#output: բարեւ աշխարհ!

See also