我有这样的数组
Array
(
[0] => Array
(
[0] => Price
[1] => 308.5
[2] => 2009
)
[1] => Array
(
[0] => Price
[1] => 308.5
[2] => 2009
)
)
我需要将"."
替换为","
in key [0][1], [1][1], [2][1]
等
答案 0 :(得分:2)
这样可行,注意您必须使用sub_array
作为参考
foreach ($arr as &$sub_arr) {
foreach ($sub_arr as &$val) {
$val = str_replace('.', ',', $val);
}
}
答案 1 :(得分:0)
试
foreach($arr as $v) {
foreach($v as $v1) {
$newarr[] = str_replace('.', ',', $v1);
}
}
print_r($newarr);