PHP strtolower()
Published Jun 22, 2023Updated Jun 6, 2025
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:
<?phpecho (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:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn PHP on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours