|
Posted by nescio on 11/07/05 11:51
i have two arrays and i want to find the elements that are unique for one of
the array's.
i use array_diff() to do this.
the problem is:
let's say i have $unique = array_diff($a, $b);
when i do sizeof($unique) i get: 1;
but when i do:
for($x = 0; $x< sizeof($unique); $x++){
echo $unique[$x];
}
i get no value at all, nothing!
i have made a sample :
-------------------- source code of sample ---------------
<?
$inhoudDir = array('a','b','c','d','e');
$inhoudDb = array('b','e');
$geenDuplicaten = array_diff($inhoudDir, $inhoudDb);
for($x=0; $x < sizeof($geenDuplicaten); $x++){
echo 'geenduplicaten: ' . $geenDuplicaten[$x] . "<br>";
}
?>
the outcome is:
geenduplicaten: a
geenduplicaten:
geenduplicaten: c
-------------------------------------------------------
how is this possible?
and how do i get al the different values?
thanks
Navigation:
[Reply to this message]
|