If Im looking to merge this PHP array into one into the lowest ID in array(1649). So that I would see only
array:1 [
1649 => array:2 [
"firstName" => "jack"
"lastName" => "straw"
"mergedWith" array:3 [
"id" =>'1650'
"id" =>'1651'
"id" =>'1652'
]
]
]
Instead of this...
array:4 [
1649 => array:2 [
"firstName" => "jack"
"lastName" => "straw"
]
1650 => array:2 [
"firstName" => "jack"
"lastName" => "straw"
]
1651 => array:2 [
"firstName" => "jack"
"lastName" => "straw"
]
1652 => array:2 [
"firstName" => "jack"
"lastName" => "straw"
]
]
I have a loop running that can pull out duplicates and find the lowest ID in the group, but not sure of the right way to collapse them into one.
The code I show are the results of a search that has identified id's with duplicate entries in those particular fields. I just want to further refine it to not delete, but add a field on the end of id 1649 that says mergedWith(1650,1651,1652)