开发者

Eliminating duplicate values using PHP

How can I eliminate duplicate in an array using PHP, array looks like below

[1] => Array
        (
            [name] => Dean
            [s_id] => 1
            [surname] => 
            [id_nr] => 84934568321
            [student_nr] => 0
            [createdate] => 0开发者_开发技巧000-00-00
            [enddate] => 0000-00-00
            [count_absent] => 3
        )

    [2] => Array
        (
            [name] => Dean
            [s_id] => 1
            [surname] => 
            [id_nr] => 84934568321
            [student_nr] => 0
            [createdate] => 0000-00-00
            [enddate] => 0000-00-00
            [count_absent] => 3
        )

    [3] => Array
        (
            [name] => Dean
            [s_id] => 1
            [surname] => 
            [id_nr] => 84934568321
            [student_nr] => 0
            [createdate] => 0000-00-00
            [enddate] => 0000-00-00
            [count_absent] => 3
        )

    [4] => Array
        (
            [name] => Dean
            [s_id] => 1
            [surname] => 
            [id_nr] => 84934568321
            [student_nr] => 0
            [createdate] => 0000-00-00
            [enddate] => 0000-00-00
            [count_absent] => 3
        )


use array_unique($array) in PHP

you can also iterate over array and compare manually


array_unique


http://php.net/manual/en/function.array-unique.php

$input = array("a" => "green", "red", "b" => "green", "blue", "red");
$result = array_unique($input);
print_r($result);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜