The code above replace 'a'.Code:code
$myVar = 'abcdABCD';
$myVar=str_replace('a','', $myVar);
echo $myVar;
result
bcdABCD
I like to replace both "a" and "A" at a time.
Printable View
The code above replace 'a'.Code:code
$myVar = 'abcdABCD';
$myVar=str_replace('a','', $myVar);
echo $myVar;
result
bcdABCD
I like to replace both "a" and "A" at a time.
Use str_ireplace() — The case-insensitive version of str_replace().
http://php.net/manual/en/function.str-ireplace.php
You can use:
$myVar=str_replace('a','', $myVar);
$myVar=str_replace('A','', $myVar);
This will replace both a and A