[eluser]BiSHGoD[/eluser]
Hello.
I've been using CI for a few weeks now and I'm really liking it. I wonder if there is any function/library to clean up a multidimensional array based on a specific key.
On PHP.net I see a lot of fixes for this problem but none that I think apply to me.
I have a multidimensional array with a few keys that might be duplicate, which can be. I have one single key that I want to be unique though.
Code:
Array
(
[0] => Array
(
[lid] => 4
[timestamp] => 2009-08-10 14:46:34
[number] => CI00101
[location] => 358 A
)
[1] => Array
(
[lid] => 5
[timestamp] => 2009-08-10 14:46:38
[number] => CI00101
[location] => 358 A
)
[2] => Array
(
[lid] => 9
[timestamp] => 2009-08-10 15:54:30
[number] => CI00101
[location] => 358 B
)
)
I want to remove dupliates based on the "location" key. So [2] should be removed, since it has the same value, 358 B, as [0].
You'll notice that "number" is the same on all of them, that shouldn't check for duplicates based on that key.
This data is from a mysql database..so if we can do this in the select statement that would work as well (right now it's 'select * from log where number = CI00101')
Thanks!