Reputation: 21
I've tried:
$input = str_replace('[IMG]',"",$input,$rplc);
with no success.
I've also tried escaping and double-escaping [IMG] by doing '[IMG]' and '\[IMG\]', neither worked. It doesn't throw any errors, but it doesn't actually replace anything either.
How can I get this to work?
Upvotes: 2
Views: 60
Reputation: 41229
Try this
preg_replace("@\[img\]@","",$input);
And the same result can also be achived by using
str_replace()
str_replace("[img]",'',$input);
Upvotes: 0
Reputation: 21422
Just try this example, to implement within your code..
$search = "[IMG]";
$replace = "";
$string = "Hello [IMG] Approxx? How[IMG] are [IMG]You?";
$input = str_replace($search, $replace, $string);
echo $input;
Upvotes: 1
Reputation: 414
Have you tried something like:
$input = preg_replace("/(\\[IMG\\])/", $replacement, $input);
Upvotes: 1