Comparing two arrays and extract the differences

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danrah
Forum Newbie
Posts: 8
Joined: Sun Dec 03, 2006 7:13 am

Comparing two arrays and extract the differences

Post by danrah »

I have two one-dimensional arrays starting from index 0. The first array stores the complete list of students' names and has (for example) 500 elements and the second array consists of a part of the larger array. How can i extract the elements that exist in the first array and not in the second array.
Thanks in advance,
koen.h
Forum Contributor
Posts: 268
Joined: Sat May 03, 2008 8:43 am

Re: Comparing two arrays and extract the differences

Post by koen.h »

danrah
Forum Newbie
Posts: 8
Joined: Sun Dec 03, 2006 7:13 am

Re: Comparing two arrays and extract the differences

Post by danrah »

Thanks, But it doesn't work and the function only returns the elements of the first array.My array contains unicode characters.What should I do to overcome this problem?
koen.h
Forum Contributor
Posts: 268
Joined: Sat May 03, 2008 8:43 am

Re: Comparing two arrays and extract the differences

Post by koen.h »

Could you give an example? Eg two example arrays and the array you need as a result.
Post Reply