The below script helps you to remove duplicate values in a array
<?php
$remove_duplicate=array('calc',"math","calc");
print_r($remove_duplicate);
echo "Script to remove duplicate values";
print_r(array_unique($remove_duplicate)); // array_unique!
?>
OUTPUT:
Array ( [0] => calc [1] => math [2] => calc )
Script to remove duplicate values
Array ( [0] => calc [1] => math )
In the above script the calc word which was repeated twice is removed by using the function array_unique
|