Re: Number of duplicates in an array?
| From: | tedd | Date: | Mon, 18 Aug 2008 14:52:26 +0000 |
| Subject: | Re: Number of duplicates in an array? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278288@lists.php.net to get a copy of this message | ||
At 3:33 PM +0100 8/18/08, Ashley Sheridan wrote:
Best way to remove duplicates from an array is to use the built in PHP function array_unique(). As for counting the number of times each unique value occurs, use array_count_values(). Ash www.ashleysheridan.co.ukAsh: I'm aware of array_unique() and have used it -- but I must have looked past array_count_values() ten times and didn't recognize it for what it was. Thanks, tedd
Hi gang: Anyone have a cool method of finding duplicate items in an array and the number of times they appear? I'm doing it in a way that is probably less than optimum. I want to see how you guys solve it. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- ------- http://sperling.com http://ancientstones.com http://earthstones.com