|
Posted by Kim Andrι Akerψ on 11/04/05 16:57
nescio wrote:
> hello,
>
> i have two array's, lets say:
> $inhoudDir = array('a','b','c','d','e','f','g','x','y','z');
> $inhoudDb = array('a','b','c','x','z');
>
> now i want to compare the two and put the elements that are only in
> $inhoudDir in a new array: $geenDuplicaten;
>
> i have tried things like:
> for($cc = 0; $cc < sizeof($inhoudDir); $cc++){
> for($dd = 0; $dd < sizeof($inhoudDb); $dd++){
> if($inhoudDir[$cc] != $inhoudDb[$dd]){
> $geenDuplicaten[] = $inhoudDir[$cc];
> }
> }
> }
>
>
> but it doesnot work: the array $geenDuplicaten should contain:
> d,e,f,g,y but i do not know how to do this;
>
> thanks
Did you think to look through the manual first? You might've discovered
the function array_diff().
http://php.net/array_diff
--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Navigation:
[Reply to this message]
|