1. Use the array_unique function
    • array_unique (PHP 4 >= 4.0.1, PHP 5)
    • array_unique (Takes an input array and returns a new array without duplicate values_)_
    • array_unique (array $array [, int $sort_flags=SORT_STRING ] )

Example:

CODE:

<?php

//Array with duplicate values $array = array(“test”,“test1”,“test”,“sum”,“minus”,“max”,“max”,“max”,“min”);

//Removing duplicate values $newArray = array_unique($array);

echo ‘’; print_r($newArray);

?> 

**OUTPUT:

**

//The above code will produce the following results without the duplicate values Array (

[0] => test [1] => test1 [3] => sum [4] => minus [5] => max [8] => min

)