PHP 8 reference · String Functions

PHP strtolower() Function

Convert every ASCII letter in a string to lowercase. Since PHP 8.2 it ignores the locale; use mb_strtolower() for é, Ü and others.

PHP 8 Since 4.0

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

strtolower(string $string): string

Parameters

ParameterDescription
string The input string.

Return value

The lowercased string.

Examples

Lowercase textTry it yourself
<?php
echo strtolower("Hello World"), "\n";
echo strtolower("[email protected]"), "\n";

Output

hello world
[email protected]
Compare without caring about caseTry it yourself
<?php
$answer = "YES";
if (strtolower($answer) === "yes") {
    echo "Confirmed\n";
}

Output

Confirmed

Version history

VersionChange
PHP 4.0Added
PHP 8.2Case conversion no longer depends on the locale: only ASCII letters A–Z change.

In other languages

Was this page helpful?