Convert String to Lowercase With PHP

Sometimes you want to convert uppercase strings to lowercase, perhaps to create a good URL for your articles – this PHP tutorial shows how to convert uppercase letters to lowercase.

We will be using the strtolower PHP function in this tutorial. The strtolower function only has a single parameter that we care about, this is the string parameter, which takes the string that we want to convert to lowercase.

The below PHP script shows how to perform simple uppercase to lowercase conversion with the strtolower function.

Shaping your URLs with lowercase letters

Its generally agreed that lowercase letters are best for URLs, so one place where you can use this function, is when shaping your URLs. The CMS system that you are using will often shape the URL as it pleases to, but the best URL format is chosen by the author of the article.

URLs should consist of lowercase letters and dashes, so a good URL would look similar to the below:

/Tutorials/uppercase-to-lowercase

You should not include a trailing slash, unless the page in question is a index type of page.