Encodera

Thanks for reading!

Donate to the site — we work hard for you.

PHP reference

strtolower

Converts ASCII letters to lowercase.

Syntax

strtolower(string $string): string

Parameters

ParameterTypeDescription
$stringstringThe source string.

Return value

stringThe string in lowercase.

Examples

Lowercase:

<?php
 
echo strtolower('Hello WORLD');

Output:

hello world

A case-insensitive comparison:

<?php
 
$answer = 'YES';
 
var_dump(strtolower($answer) === 'yes');

Output:

bool(true)

Notes

Since PHP 8 the function changes only ASCII letters. Use mb_strtolower() for Cyrillic and other alphabets.

See also

  • strtoupper — Converts ASCII letters to uppercase.
  • mb_strtoupper — Converts a string to uppercase.
  • ucfirst — Makes the first letter of a string uppercase.

Related recipes

In the tutorial

  • Strings — Working with strings in PHP — quotes, concatenation, length, searching, replacing and multibyte functions.

Thanks for reading!

Donate to the site — we work hard for you.