Im making a php site and i'm trying to get rid of all duplicate values within the key array. So if i have for example 2 twice in the key array how would i remove one of them.
My array looks like this:
Array
{
[class 1] => Array
{
[0] => 1
[1] => 2
[2] => 3
[3] => 2
}
[class 2] => Array
{
[0] => 1
[1] => 2
[2] => 3
[3] => 2
}
}
and i want to remove the duplicates that occur throughout the entire array.
Array
{
[class 1] => Array
{
[0] => 1
[1] => 2
[2] => 3
}
[class 2] => Array
{
[0] => 1
[1] => 2
[2] => 3
}
}
I've had a look online but I can only find examples of how to remove duplicate keys. Perhaps this could be done with a foreach loop but im not sure. All help appreciated. Thanks.
array_unique()on each of the child arrays.