How do I use str_replace
but to be case-insensitive when it searches for the string?
For example, suppose I want to replace ABcD
with a
.
The resulting command would be:
$string = str_replace("ABcD", "a", $string);
But if there is some string like abCD
then, again, I have to use
$string = str_replace("abCD", "a", $string);
Use the PHP functionstr_ireplace
as shown below.
$string = str_ireplace("ABcD","a",$string);