Код: Выделить всё
array (
0 => '2',
1 => 'Joe',
2 => 'Bloggs',
3 => 'joe.bloggs@mail.com',
4 => '1,2',
5 => 1,
6 => 0,
7 => 1,
)array (
0 => '2',
1 => 'Joe',
2 => 'Bloggs',
3 => 'joe.bloggs@mail.com',
4 => '1,2',
5 => 0,
6 => 1,
7 => 1,
)array (
0 => '1',
1 => 'Jane',
2 => 'Doe',
3 => 'jane.doe@mail.com',
4 => '1,4',
5 => 1,
6 => 0,
7 => 1,
)array (
0 => '1',
1 => 'Jane',
2 => 'Doe',
3 => 'jane.doe@mail.com',
4 => '1,4',
5 => 0,
6 => 0,
7 => 0,
)
Код: Выделить всё
Array
(
[0] => 2
[1] => Joe
[2] => Bloggs
[3] => joe.bloggs@mail.com
[4] => 1,2
[5] => 1
[6] => 1
[7] => 2
)
Array
(
[0] => 1
[1] => Jane
[2] => Doe
[3] => jane.doe@mail.com
[4] => 1,4
[5] => 1
[6] => 0
[7] => 1
)
Код: Выделить всё
$combined = array();
foreach ($row as $item) {
if (!array_key_exists($item[0], $combined)) {
$combined[$item[0]] = $item;
} else {
array_push($combined, $item);
}
}
Подробнее здесь: https://stackoverflow.com/questions/647 ... hin-groups