I was doing some research and came across this bit:
$colors = array("red", "green", "blue", "orange", "yellow");
$search = array("red", "green", "teal", "purple");
$matches = array_intersect($colors, $search);
foreach($matches as $val){
$id=array_search($val, $colors);
unset($colors[$id]);
}
Might it be easier to use a variation like this? Store the directorylisting, as well as the database result in an array and compare. Print the ones that are not duplicate and voila ?
I would only have to search for an array that just searches for the values NOT in both arrays 🙂