1

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] => 0000-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
        )

3 Answers 3

9

use array_unique($array) in PHP

you can also iterate over array and compare manually

Sign up to request clarification or add additional context in comments.

Comments

3

array_unique

Comments

3

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);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.