Michan Posted March 1, 2008 Share Posted March 1, 2008 Hi, I'm stuck with an array. How would I count duplicate results in array? [0] => red [1] => blue [2] => red [3] => blue [4] => red Is there a way I can easily count these results so it returns: [0] => red(3) [1] => blue(2) ..or something similar? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
trq Posted March 1, 2008 Share Posted March 1, 2008 Did you check the manual? array_count_values() does exactly what you want. Quote Link to comment Share on other sites More sharing options...
Michan Posted March 1, 2008 Author Share Posted March 1, 2008 Did you check the manual? array_count_values() does exactly what you want. Thanks! I read the manual but couldn't find this for the life of me. You've saved me a whole lot of time! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.