> Online tutorial : array_unique() in php
Showing posts with label array_unique() in php. Show all posts
Showing posts with label array_unique() in php. Show all posts

array_unique() in php

array_unique() function removes the duplicate values from an array.if two or more array values an the same ,the sirst apperence will be kept and the other will be removed
Syntax
arrray_unique(array)
Example

<?php
$sum=array(0=>"apple",1=>"orange",2=>"apple",);
echo "before using array unique";
print_r($sum);
echo "after using array unique";
print_r(array_unique($sum));

?>

Output
before using array unique

array(0=>apple
1=>orange
2=>apple)
after using array unique
array(0=>apple
1=>orange)