array_unique( ) filters an array so that a value can only appear once. : array_unique « Data Structure « PHP






array_unique( ) filters an array so that a value can only appear once.

 
<?
    $toppings2 = array("Peppers", "Ham", "Cheese", "Peppers");
    $toppings2 = array_unique($toppings2);
?>
  
  








Related examples in the same category

1.To get the unique values in an array: array_unique() function
2.Working with Unique Values