php 二维数组遍历赋值
$arr=array('one'=>array('name'=>'张三','age'=>'23','sex'=>'男'),'two'=>array('name'=>'李四...
$arr = array('one'=>array('name'=>'张三','age'=>'23','sex'=>'男'),
'two'=>array('name'=>'李四','age'=>'43','sex'=>'女'),
'three'=>array('name'=>'王五','age'=>'32','sex'=>'男'),
'four'=>array('name'=>'赵六','age'=>'12','sex'=>'女'));
foreach($arr as $key=>$value){
foreach($value as $key2=>$value2){
$arr[$ey][$value][$key2]['age']= 55;
}
}
print_r($arr);
怎么给age赋一个新值? 展开
'two'=>array('name'=>'李四','age'=>'43','sex'=>'女'),
'three'=>array('name'=>'王五','age'=>'32','sex'=>'男'),
'four'=>array('name'=>'赵六','age'=>'12','sex'=>'女'));
foreach($arr as $key=>$value){
foreach($value as $key2=>$value2){
$arr[$ey][$value][$key2]['age']= 55;
}
}
print_r($arr);
怎么给age赋一个新值? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询