Jump to content

detect duplicates


ohdang888

Recommended Posts

If you simply want to keep the unique values, use array_unique().

 

If you want to figure out what values are the same, it's a bit more complicated than using one function (unless someone else can find a simple solution). I'd go on sorting and then running over the array to check for duplicates.

 

Orio.

Link to comment
https://forums.phpfreaks.com/topic/100956-detect-duplicates/#findComment-516324
Share on other sites

If you simply want to keep the unique values, use array_unique().

 

If you want to figure out what values are the same, it's a bit more complicated than using one function (unless someone else can find a simple solution). I'd go on sorting and then running over the array to check for duplicates.

 

Orio.

 

Actually u did post the link to an example :)

The comments provided by users provide examples for non-unique values (duplicated).

 

Link to comment
https://forums.phpfreaks.com/topic/100956-detect-duplicates/#findComment-516354
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.