开发者

PHP remove values from a single array? [duplicate]

This question already has answers here: Closed 12 years ago.

Possi开发者_开发知识库ble 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
)


Use array_unique:

$a2 = array_unique($a);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜