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
mudvein
Forum Commoner
Posts: 45 Joined: Wed Mar 16, 2005 4:39 pm
Post
by mudvein » Sun Jul 24, 2005 4:11 pm
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 » Sun Jul 24, 2005 4:12 pm
i guess i should look this up before i post. the answer is to use array_count_values
shiznatix
DevNet Master
Posts: 2745 Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:
Post
by shiznatix » Sun Jul 24, 2005 4:17 pm
ha good work finding it out urself