Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

strtolower
php
lowercase
communitycreator

What is the strtolower method in PHP?

Programming Bytes

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The strtolower method can convert all the alphabetical characters of the string to lowercase characters and returns the modified string as a new string.

Syntax


strtolower(string $string): string

Returns

This method returns a new string. The string passed as the argument remained unchanged.

Code

<?php
$str = "TEST_123";
$str_lower = strtolower($str);
echo "The lowercase value of ". $str. " is ". $str_lower. "\n";
$str = "EDUcativE";
$str_lower = strtolower($str);
echo "The lowercase value of ". $str. " is ". $str_lower. "\n";
?>

Explanation

In the code above, we have used the strtolower method and converted the strings TEST_123 and EDUcativE to lowercase strings. The strtolower will convert.

Output


"TEST_123" to "test_123"
"EDUcativE" to "educative"

Refer here for more details.

RELATED TAGS

strtolower
php
lowercase
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring