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.
| SitePoint Sponsor |





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
Code PHP:$myVar = 'abcdABCD'; $myVar=str_ireplace('a','', $myVar); echo $myVar; result bcdBCD
You can use:
$myVar=str_replace('a','', $myVar);
$myVar=str_replace('A','', $myVar);
This will replace both a and A
Bookmarks