Introduction to PHP Function – array_unique() function
- The array_unique() function removes the duplicate values (key-value) from an array. Let say if an array has two or more same values then array_unique() function keeps the first value while others will be removed.
- The array_unique() function takes an array as input parameter and returns a new array with unique values (removes duplicate values).
- The array_unique() function needs a parameter of type Array. This is required parameter not optional.
- The array_unique() function does’t work for multi-dimensional arrays.
- The array_unique() function is used to maintain uniqueness within the array or to avoid the duplicity of values in an array.
Syntax:
array_unique(array)
For Example- <?php $a=array("a"=>"India","b"=>"USA","c"=>"India"); print_r(array_unique($a)); ?> Output: Array ( [a] => India [b] => USA )
Similar Posts:
- Preprocessor in C Language – Introduction of C Preprocessor & its advantages
- Google India Clinic 2012 – Register your website today for free Tips & Analysis from Google
- Indian Bloggers & Online Content Creator – YouTube Workshop Register Today!
- World’s Top College Dropout Billionaires Inspirational Look – Infographics
- Facebook Launches Internet IPO on May 18 for 28 $ to 35$ Per Share
- Godaddy 4.95$ Domain Promo Code September 2012 – Cheap Domain Registration
- Godaddy India: Customer Care Center in India- Pay via Credit, Debit Card, Net-Banking, Mobile Payments & Cash Cards
- [Fixed] How To Fix USB Mouse Not Recognized Error In PC/Laptop
Leave a Reply