我有一个像这样的多维数组:
Array
(
[0] => Array
(
[id] => 1
[email_id] => ok@gmail.com
[password] => test
)
[1] => Array
(
[id] => 2
[email_id] => check@gmail.com
[password] => test
)
[2] => Array
(
[id] => 3
[email_id] => an@gmail.com
[password] => pass
)
)
在上面的数组中,password
两个不同行的值是相同的。我需要合并具有重复值的数组以获得以下输出:
Array
(
[0] => Array
(
[0] => Array
(
[id] => 1
[email_id] => ok@gmail.com
[password] => test
)
[1] => Array
(
[id] => 2
[email_id] => check@gmail.com
[password] => test
)
)
[1] => Array
(
[id] => 3
[email_id] => an@gmail.com
[password] => pass
)
)
这个怎么做?我试过array_merge()
&foreach()
循环,但我无法得到这个输出。