The strtolower() function behaves identically in PHP 8.4 and PHP 8.5. There are no version specific changes for this function in either release. The most recent behavioral change dates back to PHP 8.2.0, when case conversion was made locale independent and restricted to ASCII characters only.
Function
strtolower() returns a string with all ASCII alphabetic characters (Athrough Z) converted to lowercase.
Signature:
strtolower(string $string): string
Key Behavior:
- ASCII Only: It only converts ASCII characters. Multibyte characters (like accented letters in UTF-8) are ignored. For those, you should use mb_strtolower().
- Binary Safe: The function can safely be used on binary data .
Example
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);
echo $str;
// Outputs: mary had a little lamb and she loved it so
?>
This example is the standard usage shown in the PHP manual and works across all supported PHP 8.x versions .
Important Note (PHP 8.2+)
Since PHP 8.2, strtolower() no longer depends on the locale set by setlocale(). It will only convert ASCII characters, regardless of the server is locale settings. This is a change from older PHP versions and is the most critical behavioral aspect to remember when migrating legacy code.