我只是试图将包含用逗号分隔的数字的数组解析为没有逗号的数字,但仍然是数组形式。但它没有用。
我的代码:
$total = $this->input->post('total');
$arrTot = array_filter(array_slice($total, 20));
print_r($arrTot);
数组结果:
Array
(
[0] => 10,000
[1] => 100,000
[2] => 200,000
)
我想要的输出是删除所有数字中的逗号:
Array
(
[0] => 10000
[1] => 100000
[2] => 200000
)
我已经尝试过这样的事情,但它似乎与我想要的输出并不接近:
$total = $this->input->post('total');
$arrTot = array_filter(array_slice($total, 20));
for ($i=0; $i < count($arrTot); $i++) {
$valTot=str_replace( ',', '', $arrTot[$i]);
print_r($valTot);
}
有没有办法解决这个问题?
慕无忌1623718
MMMHUHU
烙印99