Remove Duplicates from PHP Array
Before you write a quickie function to remove duplicates from a PHP array, check out the PHP array_unique() function. I was about to write a function to de-dupe an array when I remembered that PHP has a builtin function to do just that.
Here is a simple example:
PHP:
Alternatively, if you just want to know if there are duplicates in an array and not remove them, you could do something like this:
PHP:
-
function isUnique($array){
-
-
-
}
Home | PHP | Remove Duplicates from PHP Array
You’re currently reading “ Remove Duplicates from PHP Array ,” an entry on BRADINO
- Published:
- 10.19.07 / 4pm
- Category:
- PHP












