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);
Then instead of using str_replace
try usingstr_ireplace
Its a case insensitive version of str_replace
so use it as
$string = str_ireplace("ABcD","a",$string);