Voting

: four plus five?
(Example: nine)

The Note You're Voting On

Dorphalsig
16 years ago
I had a problem with array_unique and multidimensional arrays ... Maybe there's a better way to do this, but this will work for any dimensional arrays.

<?php
function arrayUnique($myArray)
{
if(!
is_array($myArray))
return
$myArray;

foreach (
$myArray as &$myvalue){
$myvalue=serialize($myvalue);
}

$myArray=array_unique($myArray);

foreach (
$myArray as &$myvalue){
$myvalue=unserialize($myvalue);
}

return
$myArray;

}
?>

<< Back to user notes page

To Top