How To Remove Duplicate Value From Array ?

Discussion in 'PHP' started by tvshock, Nov 23, 2009.

  1. #1
    hello

    i has some problem. how can i remove duplicate values from array example like this

    <?php


    $array[0] = "1";
    $array[1] = "5";
    $array[2] = "10";
    $array[3] = "1";
    $array[4] = "1";

    ?>

    how can i search array with same value like $array[0], $array[3] and $array[4].

    sorry if you don't understand my question.
     
    tvshock, Nov 23, 2009 IP
  2. CreativeClans

    CreativeClans Peon

    Messages:
    128
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
  3. xenon2010

    xenon2010 Peon

    Messages:
    237
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    $array[0] = "1";
    $array[1] = "5";
    $array[2] = "10";
    $array[3] = "1";
    $array[4] = "1";
    
    $result = array_unique($array);
    print_r($result);
    PHP:
     
    xenon2010, Nov 24, 2009 IP