I have this array in php :
array:5 [
0 => array:3 [
"tab" => "9"
"layout_id" => "11"
"banners_ids" => "7"
]
1 => array:3 [
"tab" => "9"
"layout_id" => "11"
"banners_ids" => "8"
]
2 => array:3 [
"tab" => "10"
"layout_id" => null
"banners_ids" => null
]
3 => array:3 [
"tab" => "11"
"layout_id" => null
"banners_ids" => null
]
4 => array:3 [
"tab" => "12"
"layout_id" => null
"banners_ids" => null
]
]
And i need to merge in the same array those that have the same "tab" key to have something like this:
array:5 [
0 => array:3 [
"tab" => "9"
"layout_id" => "11"
"banners_ids" => "8,7"
]
1 => array:3 [
"tab" => "10"
"layout_id" => null
"banners_ids" => null
]
2 => array:3 [
"tab" => "11"
"layout_id" => null
"banners_ids" => null
]
3 => array:3 [
"tab" => "12"
"layout_id" => null
"banners_ids" => null
]
]
How can I reach this? I trie with a foreach and positions like current() or prev() but with no result.