PHP strtolower() Function

Last updated on February 24, 2023

In PHP, the strtolower() function converts all the characters into lowercase. It accepts one parameter and returns the value in the string.

For example, if you pass “LEARN CODING” into the strtolower() function as an argument then it would return “learn coding”.

Syntax

strtolower(string)

Parameters

It has one required parameter that refers to the value which needs to be converted into lowercase.

PHP Supported Version

  • PHP 4
  • PHP 5
  • PHP 7
  • PHP 8

Usage

You can directly pass the value into the function that needs to be converted.

echo strtolower("LEARN CODING");
// Output: learn coding

Also, it works with variables. So you need to create a variable and store a string.

// save string to variable
$string = "LEARN CODING";

echo strtolower($string);
// Output: learn coding

In this example, we stored a string containing capitalized characters into a variable and passed it into the strtolower() function for converting it into uppercase.


Written by
I am a skilled full-stack developer with extensive experience in creating and deploying large and small-scale applications. My expertise spans front-end and back-end technologies, along with database management and server-side programming.

Share on:

Related Posts

Tags: PHP, PHP-Functions,