SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Php
-
Jun 19, 2009, 06:53 #1
- Join Date
- Jun 2009
- Posts
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Php
How do you remove duplicate values from an array?
-
Jun 19, 2009, 06:59 #2
- Join Date
- Aug 2000
- Location
- Philadephia, PA
- Posts
- 20,578
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
array_unique — Removes duplicate values from an arrayTry Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more
-
Jun 19, 2009, 08:05 #3
- Join Date
- Jul 2005
- Location
- Orlando
- Posts
- 634
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
As an aside, I've found using array_unique on very large arrays to take too long.
I find it's faster to store the value as the key of the array, too, which prevents duplicates and is faster in my testing.
instead of:
$arr[] = 5;
do
$arr[5] = 5;
Bookmarks