我正在尝试遍历此数组以更改列值:
array
0 => null
1 =>
array
'condition' =>
array
'column' => string 'data' (length=12)
'operator' => string '=' (length=1)
'argvalue' => string '442' (length=3)
2 =>
array
'condition' =>
array
'column' => string 'start' (length=5)
'operator' => string '>=' (length=2)
'argvalue' => string '2013-11-21 00:00:00' (length=19)
3 =>
array
'condition' =>
array
'column' => string 'start' (length=5)
'operator' => string '<=' (length=2)
'argvalue' => string '2013-11-21 23:59:59' (length=19)
4 => null
这是我的代码,虽然我可以访问$ secondLevelIndex ['column']但我似乎无法更改该值。
foreach ($created as $firstLevelIndex => $firstLevelArray) {
foreach ($firstLevelArray as $secondLevelIndex) {
//echo $secondLevelIndex['column'];
$created[$firstLevelIndex][$secondLevelIndex]['column'] = 100;
}
}
任何想法都会受到赞赏。
答案 0 :(得分:2)
试试吧。
foreach ($created as $firstLevelIndex => $firstLevelArray) {
foreach ($firstLevelArray as $secondLevelIndex => $secondLevelArray) {
//echo $secondLevelIndex['column'];
$created[$firstLevelIndex][$secondLevelIndex]['column'] = 100;
}
}
答案 1 :(得分:1)
试试这个
foreach ($created as $firstLevelIndex => $firstLevelArray) {
foreach ($firstLevelArray as $secondLevelIndex => $firstLevelArray) {
//echo $secondLevelIndex['column'];
$created[$firstLevelIndex][$secondLevelIndex]['column'] = 100;
}
}
答案 2 :(得分:1)
这样的事情应该有效:
foreach ($created as $firstLevelIndex => $firstLevelArray) {
foreach ($firstLevelArray as $secondLevelIndex=>$value) {
//echo $secondLevelIndex['column'];
$created[$firstLevelIndex][$secondLevelIndex]['column'] = 100;
}
}