www.webdeveloper.com
Results 1 to 3 of 3

Thread: How do I remove duplicates in an array?

  1. #1
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364

    How do I remove duplicates in an array?

    If I have an array, let's say:

    "test", "place", "park", "park", "test", "run"

    I want to remove the duplicate values in the array so that each cell is unique:

    "test", "place", "park", "run"

    How can I accomplish this? Is there a function I can use for this?

    Thanks!

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,321
    Believe it or not: array_unique().
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364
    That did it! Thanks!

    You know, I did come across that earlier. It didn't work for me, but I went back and tried it, and apparently I misspelled my variable.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles