【发布时间】:2017-05-17 20:12:03
【问题描述】:
对不起,这个基本问题,但我不知道怎么做。 我在 PHP 中有 2 个带有虚拟数据的数组
Arr1[
[0] => [
[user_id] => 1,
[first_name] => 'justin',
[last_name] => 'bieber'
],
[1] => [
[user_id] => 2,
[first_name] => 'terry',
[last_name] => 'crews'
]
];
Arr2[
[0] => [
[user_id] => 1,
[height] => 180,
[weight] => 80
],
[1] => [
[user_id] => 2,
[height] => 150,
[weight] => 70
]
];
如何合并这些数组并得到结果数组?
ArrResult[
[0] => [
[user_id] => 1,
[first_name] => 'justin',
[last_name] => 'bieber'
[height] => 180,
[weight] => 80
],
[1] => [
[user_id] => 2,
[first_name] => 'terry',
[last_name] => 'crews'
[height] => 150,
[weight] => 70
]
];
你知道更好的方法吗?
【问题讨论】:
-
比什么更好?
-
任何解决方法
-
@symcbean 比记事本好
-
您应该尝试自己编写代码。在doing more research 之后,如果您有问题发布您尝试过的方法,并清楚地解释什么不起作用,并提供a Minimal, Complete, and Verifiable example。阅读How to Ask 一个好问题。请务必take the tour 并阅读this。
标签: php