strtolower
Converts ASCII letters to lowercase.
Syntax
strtolower(string $string): stringParameters
| Parameter | Type | Description |
|---|---|---|
| $string | string | The source string. |
Return value
stringThe string in lowercase.
Examples
Lowercase:
<?php
echo strtolower('Hello WORLD');Output:
hello worldA 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.