strtolower()

Published Jun 22, 2023Updated Jul 17, 2023
Contribute to Docs

The strtolower() function in PHP converts a string to lowercase.

Syntax

strtolower($string);

The strtolower() function takes one parameter, $string, as input and returns a new string with all the characters converted to lowercase. The $string can be any string value.

Example

The following example uses the strtolower() function to convert a capitalized string to a lowercase string. Then the echo command prints this string to the console:

<?php
echo (strtolower( "I Solemnly Swear That I Am Up To No Good"));
?>

The example will result in the following output:

i solemnly swear that i am up to no good

Codebyte Example

The following example uses the strtolower() function on a string:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn PHP on Codecademy