I have a multi-dimensional array like this:
Array
(
[0] => Array
(
[id] => 1
[email_id] => [email protected]
[password] => test
)
[1] => Array
(
[id] => 2
[email_id] => [email protected]
[password] => test
)
[2] => Array
(
[id] => 3
[email_id] => [email protected]
[password] => pass
)
)
In the above array, password value is the same in two different rows. I need to merge the arrays which have duplicate values to get the following output:
Array
(
[0] => Array
(
[0] => Array
(
[id] => 1
[email_id] => [email protected]
[password] => test
)
[1] => Array
(
[id] => 2
[email_id] => [email protected]
[password] => test
)
)
[1] => Array
(
[id] => 3
[email_id] => [email protected]
[password] => pass
)
)
How to do this? I've tried array_merge() & foreach() loops, but I can't get this output.
password?