comparing an array to an array

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
ibanez270dx
Forum Commoner
Posts: 74
Joined: Thu Jul 27, 2006 12:06 pm
Location: Everywhere, California

comparing an array to an array

Post by ibanez270dx »

hello,
I have two arrays. My first array is $user_member_of = ["it_support","human_resources"] and my second is $file_posted_for = ["1","administration","human_resources","5","19"]. What I need to do is check if any of the values from my first array are in the second array. I used to use in_array(), but that was when $user_member_of was a string... it doesn't work with an array.

Any help is appreciated!!!

Thanks,
- Jeff
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: comparing an array to an array

Post by VladSun »

Last edited by VladSun on Fri Jun 13, 2008 7:28 pm, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
ibanez270dx
Forum Commoner
Posts: 74
Joined: Thu Jul 27, 2006 12:06 pm
Location: Everywhere, California

Re: comparing an array to an array

Post by ibanez270dx »

EXACTLY what I was looking for! Thanks!!
Post Reply