📜  在php代码示例中删除数字中的逗号

📅  最后修改于: 2022-03-11 14:54:30.908000             🧑  作者: Mango

代码示例1
$var = 18,542.00;
$var = intval(preg_replace('/[^\d.]/', '', $var));
result :- 18542;
or if you need float
$var = floatval(preg_replace('/[^\d.]/', '', $var));
result :- 18542.00;