in_array(); | remove duplicate item from array?
Posted: Wed Nov 11, 2009 9:38 am
hi!
i am working on a photo gallery thumbnail index that has a featured gallery position.
in my thumbnail index, I need to omit the featured gallery 'id' if it exists, so that i don't have the featured gallery duplicated in the thumbnail index.
i understand that using in_array($id, $array); will help me discern if an '$id' appears in an '$array'.
what i don't understand is how to write:
if the $id is in the $array, remove $id and build new $array without it.
could someone help explain that with functions?
thank you so much DevNet
i am working on a photo gallery thumbnail index that has a featured gallery position.
in my thumbnail index, I need to omit the featured gallery 'id' if it exists, so that i don't have the featured gallery duplicated in the thumbnail index.
i understand that using in_array($id, $array); will help me discern if an '$id' appears in an '$array'.
what i don't understand is how to write:
if the $id is in the $array, remove $id and build new $array without it.
could someone help explain that with functions?
thank you so much DevNet