2013-10-15 17 views

risposta

1

È possibile utilizzare sostituzione di stringa, str_replace o preg_replace sono soluzioni praticabili.

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

PHP dovrebbe prendersi cura di casting di tipo dopo che così avete a che fare con un numero intero.

2

Si può sbarazzarsi delle virgole facendo

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

poi

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

Sì, è possibile:

$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

Th è può essere realizzato sottoprodotti

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

Qui intval() viene utilizzata per convertire la stringa a intero.

Problemi correlati