duplicate values within 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
mudvein
Forum Commoner
Posts: 45
Joined: Wed Mar 16, 2005 4:39 pm

duplicate values within an array?

Post by mudvein »

how can i count how many times a key is found within an array?

ie :

$array = ('bob','sam','sally','bob');

I want to be able to say bob has appeared within this array twice. is that possible? if so, how? thanks.
mudvein
Forum Commoner
Posts: 45
Joined: Wed Mar 16, 2005 4:39 pm

Post by mudvein »

i guess i should look this up before i post. the answer is to use array_count_values
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

ha good work finding it out urself
Post Reply