如何从字符串中删除匹配的字符?

时间:2011-04-04 14:25:15

标签: php

这是我的代码

$a = "Hey there, how do i remove all, the comma from this string,";
$a = str_replace($a,',','';)
echo $a;

我想删除字符串中可用的所有逗号,我该怎么办?

2 个答案:

答案 0 :(得分:3)

$a = str_replace(",", "", $a);

答案 1 :(得分:1)

$a = "Hey there, how do i remove all, the comma from this string,";
$a = str_replace(',','',$a);
echo $a;

错误的分号和错误的函数参数。