Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to remove duplicate values from a multi-dimensional array in PHP?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 123
    Comment on it

    The array_unique() function removes duplicate values from an array. If two or more array values are the same, the first appearance will be kept and the other will be removed.

    Example :

    1. <?php
    2. $a=array("a"=>"red","b"=>"green","c"=>"red");
    3. print_r(array_unique($a));
    4. ?>

    Output :

    1. Array ( [a] => red [b] => green )

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: