无法计算php str_replace()以删除逗号

无法计算php str_replace()以删除逗号,php,string,str-replace,comma,Php,String,Str Replace,Comma,在PHP项目中,我有: $string = "1,555"; str_replace(',', '', $string); echo $string; //is still 1,555 str_replace不会删除逗号。如果我倒垃圾。我得到字符串(5)“1555” 有什么想法吗?我只需要去掉逗号就可以计算了 $string = str_replace(',', '', $string);

在PHP项目中,我有:

$string = "1,555";

str_replace(',', '', $string);
echo $string; //is still 1,555
str_replace不会删除逗号。如果我倒垃圾。我得到
字符串(5)“1555”

有什么想法吗?我只需要去掉逗号就可以计算了

$string = str_replace(',', '', $string);