How to use str_replace( ) function In PHP
PHP str_replace() method replaces each uppercase character in the string with its corresponding lowercase character using str_replace( )
.
$string = "w3wiki";
$lowercaseString = str_replace(range('A', 'Z'), range('a', 'z'), $string);
echo "Lowercase using str_replace(): $lowercaseString";
How to convert a String to Lowercase in PHP?
Converting a string to lowercase in PHP is a common operation that allows you to standardize string formats or perform case-insensitive comparisons.
Table of Content
- Using strtolower() function
- Using mb_strtolower() function
- Using str_replace( ) function
- Using Loop