SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: arrays.

  1. #1
    SitePoint Addict
    Join Date
    May 2001
    Posts
    217
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    arrays.

    how do i get all the unique values from an array? something like the distinct feature in a mysql query, but using an array?

    ex :

    array[0] = "un";
    array[1] = "zxc";
    array[2] = "zxc";
    array[3] = "abc";


    how do i get only the unique values?

  2. #2
    code addict Abstraction's Avatar
    Join Date
    Apr 2001
    Location
    Des Moines, IA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After looking at http://www.php.net/manual/en/ref.array.php I don't see a built in function. It looks like you'll have to roll your own.

  3. #3
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually array_unique is on there and it returns an array with unique values.

  4. #4
    code addict Abstraction's Avatar
    Join Date
    Apr 2001
    Location
    Des Moines, IA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My bad...I misuderstood what he wanted.


Bookmarks

Posting Permissions

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