You are here: Re: finding differences between two arary's « All PHP « IT news, forums, messages
Re: finding differences between two arary's

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация