I want to replace some strings by other one. I use below codes:
$mc = 'Hello I have these bages: [A-561],[A-123],[A-1],[A-5234]';
$medal = '<img src="1" />';
$bages = preg_replace('/^\[A-[0-9]+\]/i',$medal,$mc);
echo $bages
it prints out this:
Hello I have these bages: [A-561],[A-123],[A-1],[A-5234]
and if i change $mc to
$mc = "[A-561],[A-123],[A-1],[A-5234]";
then prints out:
<img src="1" />,[A-123],[A-1],[A-5234]
I have no idea why it happens like this. i want to change all of them to my replace string.