Jump to content

array_unique() is leaving empty values in array...


Fog Juice

Recommended Posts

Hello,

 

I'm using array_unique() to clear out duplicate values in an array that contains about 1125 items. All items in the array are string value but for some reason, array_unique() will clear out duplicates and in some instances leave an empty value in the array.

 

Does anyone know what might cause this?

 

*update* I tried array_keys(array_flip()) and that seems to work better. Any idea what the problem is with array_unique()?

Array unique preserves the keys of the array, (as it says on the php.net documentation) so that probably has something do to with the empty values. But I don't use array_unique to often so beyond that i don't really know

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.