SQL PHP HTML ASP JavaScript articles and free scripts to download
 

PHP array unique value

We may want to get a set of unique values from an array. For this we have to use function array_unique(). This will take an array as input and return an array with unique elements of the old array.

Here is our old array with some duplicate elements.

$old_array=array("Mango","Banana","Orange","Banana"); 
$new_array=array_unique($old_array); 

 Now our $new_array will contain values ("Mango","Banana","Orange")








Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked


Join Our Email List
Email:  
For Email Newsletters you can trust
Array Functions
PHP Sections