php二维数组添加元素
假设我有一个数组$arrs=Array([0]=>Array([id]=>1[rid]=>175[name]=>sdf[salary]=>sdf[cityStr]=>sd...
假设我有一个数组$arrs=Array
(
[0] => Array
(
[id] => 1
[rid] => 175
[name] => sdf
[salary] => sdf
[cityStr] => sdf
[experience] => sdf
[degree] => sdf
[isNew] => sdf
)
[1] => Array
(
[id] => 2
[rid] => 175
[name] => wer
[salary] => wer
[cityStr] => wer
[experience] => wer
[degree] => wer
[isNew] => wer
)
)
现在我想实现,给这个数组中,每个键值下的数组里再加入一个元素,变成如下这样:
Array
(
[0] => Array
(
[id] => 1
[rid] => 175
[name] => sdf
[salary] => sdf
[cityStr] => sdf
[experience] => sdf
[degree] => sdf
[isNew] => sdf
[url]=>这里的值是上面的[id]的值
)
[1] => Array
(
[id] => 2
[rid] => 175
[name] => wer
[salary] => wer
[cityStr] => wer
[experience] => wer
[degree] => wer
[isNew] => wer
[url]=>这里的值是上面的[id]的值
)
)
应该如何实现呢?谢谢! 展开
(
[0] => Array
(
[id] => 1
[rid] => 175
[name] => sdf
[salary] => sdf
[cityStr] => sdf
[experience] => sdf
[degree] => sdf
[isNew] => sdf
)
[1] => Array
(
[id] => 2
[rid] => 175
[name] => wer
[salary] => wer
[cityStr] => wer
[experience] => wer
[degree] => wer
[isNew] => wer
)
)
现在我想实现,给这个数组中,每个键值下的数组里再加入一个元素,变成如下这样:
Array
(
[0] => Array
(
[id] => 1
[rid] => 175
[name] => sdf
[salary] => sdf
[cityStr] => sdf
[experience] => sdf
[degree] => sdf
[isNew] => sdf
[url]=>这里的值是上面的[id]的值
)
[1] => Array
(
[id] => 2
[rid] => 175
[name] => wer
[salary] => wer
[cityStr] => wer
[experience] => wer
[degree] => wer
[isNew] => wer
[url]=>这里的值是上面的[id]的值
)
)
应该如何实现呢?谢谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询