php 从数组树中获取级别数组
我有下一个数组: 大批 ( [1000] =>大批 ( [pv] => 81 )
[1101] => Array
(
[1102] => Array
(
[pv] => 33
)
[1103] => Array
(
[pv] => 15
)
[pv] => 72
)
) 我想从中创建新数组,如下所示:
Array(
[1000] => Array(['generation'] => 1, ['pv'] => 81)
[1101] => Array(['generation'] => 1, ['pv'] => 72)
[1102] => Array(['generation'] => 2, ['pv'] => 33)
[1103] => Array(['generation'] => 2, ['pv'] => 15)
)
生成是数组深度的一个级别。有很多级别。 谢谢。
I Have the next array:
Array
(
[1000] => Array
(
[pv] => 81
)
[1101] => Array
(
[1102] => Array
(
[pv] => 33
)
[1103] => Array
(
[pv] => 15
)
[pv] => 72
)
)
I want to make new array from this like this:
Array(
[1000] => Array(['generation'] => 1, ['pv'] => 81)
[1101] => Array(['generation'] => 1, ['pv'] => 72)
[1102] => Array(['generation'] => 2, ['pv'] => 33)
[1103] => Array(['generation'] => 2, ['pv'] => 15)
)
Generation is a level of array's deep. There are a lot of levels.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有创意...
Be creative...