0

Possible Duplicate:
How to remove duplicate values from an array in PHP

How can I remove all multiple values for example 55,55 will only be 55 using PHP

Example 1

Array
(
    [0] => 9
    [1] => 2
    [2] => 55
    [3] => 55
    [4] => 9
)

Example 1 should look like example 2 below.

Array
(
    [0] => 9
    [1] => 2
    [2] => 55
)
1

1 Answer 1

7

Use array_unique:

$a2 = array_unique($a);
Sign up to request clarification or add additional context in comments.

1 Comment

You're TWO seconds faster!!!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.