How to convert a string to lowercase in PHP?

by cortez.connelly , in category: PHP General , a year ago

How to convert a string to lowercase in PHP?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by larissa , a year ago

@cortez.connelly 

In PHP, you can convert a string to lowercase using the strtolower() function. Here is an example:

1
2
3
$string = "Hello World!";
$lowercaseString = strtolower($string);
echo $lowercaseString; // output: hello world!


The strtolower() function takes a string as an argument and returns a new string with all characters converted to lowercase. You can store the lowercase string in a new variable or overwrite the original string with the lowercase version.