#1
  1. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,216
    Rep Power
    220

    array_unique being a total ****


    Hi;

    I am having some personal issues with array_unique
    Code:
    $sizes = array_unique($sizes);		
          print_r($sizes);
    prints this
    Code:
    Array ( 
    [3.5 in x 2.1 in] => 3.5 in x 2.1 in 
    [3.5 in x 2.1 in] => 3.5 in x 2.1 in 
    )
    How come it doesn;t remove the duplicate?

    Thanks
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,394
    Rep Power
    9645
    You know that arrays can't have duplicate keys, right? Yet somehow you have
    Code:
    [3.5 in x 2.1 in] => 3.5 in x 2.1 in
    [3.5 in x 2.1 in] => 3.5 in x 2.1 in
    Those two keys must somehow be different, and that probably means the two values are different too.

    Try var_dump() for more details.

    Comments on this post

    • Sepodati agrees
  4. #3
  5. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,216
    Rep Power
    220
    Got it. There was an extra space and couldnt see it in inspect.
  6. #4
  7. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,216
    Rep Power
    220
    And thanks xo

IMN logo majestic logo threadwatch logo seochat tools logo