php foreach中赋值
$num=1;$arr=array(0=>('id'=>'157''uid'=>'9''active_id'=>'157''num'=>$num)1=>('id'=>'1...
$num=1;
$arr=array(
0 => (
'id' => '157'
'uid' => '9'
'active_id' => '157'
'num'=>$num)
1=>(
'id' => '157'
'uid' => '9'
'active_id' => '157'
'num'=>$num)
)如何用foreach在数组中加一元素‘‘num’’
foreach( $arr as $va){
foreach($va as $v){
$v['num']=$num;
}}
这样对吗? 展开
$arr=array(
0 => (
'id' => '157'
'uid' => '9'
'active_id' => '157'
'num'=>$num)
1=>(
'id' => '157'
'uid' => '9'
'active_id' => '157'
'num'=>$num)
)如何用foreach在数组中加一元素‘‘num’’
foreach( $arr as $va){
foreach($va as $v){
$v['num']=$num;
}}
这样对吗? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询