strtolower() Function in PHP 8.1 and 8.2 With Example

Support PHP Version: PHP 7.1, PHP 7.2, PHP 7.3, PHP 7.4, PHP 8.0, PHP 8.1, PHP 8.2, PHP 8.3 With Latest All Version Support.

Hello Friends Today, through this tutorial, I will tell you How to Use `strtolower()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. The `strtolower()` function in PHP is used to convert a string to lowercase. It’s available in both PHP 8.1 and PHP 8.2. Here’s how you can use it with an example:

<?php

// String to convert to lowercase
$string = "Hello, World!";

// Convert the string to lowercase
$lowercase_string = strtolower($string);

// Output the lowercase string
echo $lowercase_string;

?>

In this example:

1. The variable `$string` holds the original string `”Hello, World!”`.
2. The `strtolower()` function is applied to `$string`, converting all characters to lowercase.
3. The resulting lowercase string is stored in the variable `$lowercase_string`.
4. Finally, the lowercase string is echoed out.

The output will be:

hello, world!

You can use `strtolower()` to normalize strings for comparison or consistent output formatting, especially when dealing with case-insensitive comparisons or when you want to standardize the case of input data.