Search code snippets, questions, articles...

Convert characters to lowercase using strtolower() function in PHP

In PHP, the strtolower() function converts all uppercase characters in a string to lowercase. This function is useful for strings that are meant to be case-insensitive, such as email addresses.
<?php
   echo strtolower("WORLD IS BEAUTIFUL");
?>
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place.

Output

world is beautiful

In the above code example, we have converted all the characters of String "WORLD IS BEAUTIFUL" to lowercase. The PHP function strtolower() will convert all the charters of the string to lowercase. It takes the string as a parameter and returns the same string in the lowercase format.

strtolower($str)

More Examples

Below are the code examples that can help you to better understand the functionality of strtolower() function.

<?php
  echo strtolower("We are ProgRammers");
  // -> we are programmers
  
  echo strtolower("make the WORLD a Beautiful Place");
  // -> make the world a beautiful place
  
  echo strtolower("Hello world");
  // -> hello world
?>
Was this helpful?
0 Comments