Remove duplicate items from an array [duplicate]

The array_unique function will do this for you. You just needed to add the SORT_REGULAR flag:

$items_thread = array_unique($items_thread, SORT_REGULAR);

However, as bren suggests, you should do this in SQL if possible.

Leave a Comment