Php - Function array unique, Remove duplicate values in a array


Function array unique
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

Php - Remove duplicate values in a array
The topic on Php - Function array unique is posted by - Math
Hope you have enjoyed, Php - Function array unique . Thanks for your time.

All rights reserved. © www.w3calculator.com