Web Analytics

PHP strtolower() Function

String Function PHP 4+

The strtolower() function converts all alphabetic characters in a string to lowercase.

Syntax

strtolower(string $string): string

Parameters

ParameterTypeDescription
$stringstringThe input string

Return Value

Returns the string with all alphabetic characters converted to lowercase.

Try It Online

Output
Click Run to execute your code

More Examples

Case-Insensitive Comparison

<?php
$input = "YES";
if (strtolower($input) === "yes") {
    echo "User agreed!";
}
?>

Email Normalization

<?php
$email = "[email protected]";
$normalized = strtolower($email);
echo $normalized;  // "[email protected]"
?>
Note: For UTF-8 strings with special characters, use mb_strtolower() instead.

Common Use Cases

  • Case-insensitive string comparisons
  • Email normalization
  • URL slug generation
  • Username validation

Related Functions

  • strtoupper() - Convert to uppercase
  • ucfirst() - Capitalize first letter
  • ucwords() - Capitalize each word
  • mb_strtolower() - UTF-8 safe version