是否有一个原因str_replace不适用于这个短语

I am trying to replace the following text

options":{"icon": "color.php?tx=31c},

into

options":{"icon": "color.php?tx=31*},

basically removing the 'c' and replacing it with an asterisk and the php function i'm using is as simple as a str_replace. So my code is as follow

$str = 'options":{"icon": "color.php?tx=31c},';
$newStr = str_replace("c},","*},",$str);

but for some reason when i echo $newstr, the str_replace didn't replace anything. I tried with just c, it works. I tried with just the }, it works. But not together. Anyone has any idea?

Semicolon (;) missing on first line. Should be:

$str = 'options":{"icon": "color.php?tx=31c},';
<?php

$str = 'options":{"icon": "color.php?tx=31c},';
$newStr = str_replace("c},","*},",$str);
echo $newStr;

This code works perfectly for me. See this link : https://ideone.com/wOTb8V

As you can see, the output is options":{"icon": "color.php?tx=31*},

Maybe you are trying to echo $str instead of $newStr ?