将逗号分隔的字符串转换为int PHP?

问题描述:

有什么方法可以使用PHP将185,345,321转换为185345321吗?

Is there any way you can convert "185,345,321" to 185345321 by using PHP?

是的,有可能:

$str = "185,345,321";
$newStr = str_replace(',', '', $str); //If you want it to be "185345321"
$num = intval(@newStr); //If you want it to be a number 185345321