2013-10-15 123 views

回答

1

您可以使用字符串替换,str_replacepreg_replace是可行的解决方案。

$string = str_replace(",","","185,345,321"); 

PHP 应该照顾类型转换之后,所以你对付一个整数。

2

您可以通过执行

$newString = str_replace(",", "", $integerString); 

然后

$myNewInt = intval($newString); 
1
$str = "185,345,321"; 
$newstr = str_replace(',','',$str); 
echo $newstr; 
5

是的,有可能摆脱逗号:

$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 
2
$string= "185,345,321"; 
echo str_replace(",","",$string); 
4

钍是可以逐个

$intV = intval(str_replace(",","","185,345,321")); 

这里intval()可以实现用于将字符串转换为整数。

相关问题