Hi,
I have the following array and would like to loop through it and check if there are duplicate catalogIDs, if yes, I would like to compare the dates and choose the earliest date.
In the following array:
catalogID 1257 is there two times. I need earliest date, which is 2013-09-03
catalogID 1340 is there three times. I need earliest date, which is 2013-09-04
Array
(
[0] => 1159, 2013-09-03
[1] => 1157, 2013-09-03
[2] => 1257, 2013-09-03
[3] => 1257, 2013-09-13
[4] => 1340, 2013-09-04
[5] => 1335, 2013-09-03
[6] => 1340, 2013-09-13
[7] => 1410, 2013-09-03
[8] => 1340, 2013-09-18
)
Is it easier to add all the unique catalogIDs with the earliest date to a new array or remove the duplicate catalogIDs with the late dates from the current array?
I have tried a foreach loop and a for loop with counter but I'm not able to do this.
Any ideas?
Thanks!