Page 1 of 1

Removing EMPTY or BLANK entries from an array?

Posted: Wed Feb 15, 2006 10:45 pm
by Deseree
Hi,
What would you guys advise for removing empty entries in an array, and rekeying, but not resorting at all.

array_unique works to some extent but there is still ONE empty entry and it's just on my nerves...

Posted: Wed Feb 15, 2006 10:56 pm
by josh
Loop through the array and test the value with empty(), use array_splice() to splice out entries one at a time

Posted: Wed Feb 15, 2006 11:31 pm
by feyd
array_filter($array,'strlen') or array_filter($array) depending on what you are actually after.