In this PHP tutorial, you shall learn how to convert a given string to lowercase using strtolower() function, with example programs.
PHP – Convert string to lowercase
To convert a string to lowercase in PHP, use strtolower()
function. Call strtolower()
and pass the given string as argument.
Syntax
The syntax to convert the string str
to lowercase using strtolower()
function is
</>
Copy
strtolower($str);
The function returns a string value with all the characters in the given string converted to lowercase.
Examples
1. Convert string to lowercase
In this example, we will take a string str
that has some uppercase characters. We convert this string to lowercase and print it.
PHP Program
</>
Copy
<?php
$str = 'Hello World';
$output = strtolower($str);
echo $output;
?>
Output
Conclusion
In this PHP Tutorial, we learned how to convert a string to lowercase, using strtolower()
function.