What is the strtolower method in PHP?
The strtolower method can convert all the alphabetical characters of the string to lowercase characters and returns the modified string as a new string.
Syntax
strtolower(string $string): string
Returns
This method returns a new string. The string passed as the argument remained unchanged.
Code
<?php$str = "TEST_123";$str_lower = strtolower($str);echo "The lowercase value of ". $str. " is ". $str_lower. "\n";$str = "EDUcativE";$str_lower = strtolower($str);echo "The lowercase value of ". $str. " is ". $str_lower. "\n";?>
Explanation
In the code above, we have used the strtolower method and converted the strings TEST_123 and EDUcativE to lowercase strings. The strtolower will convert.
Output
"TEST_123" to "test_123"
"EDUcativE" to "educative"
Refer here for more details.