PHP strtolower()

Sriparno08's avatar
Published Jun 22, 2023Updated Jun 6, 2025
Contribute to Docs

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

  • 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

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:

Code
Output

All contributors

Contribute to 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