I have a multidimensional array looking like this:
Array
(
[0] => Array
(
[id] => 1
[genretitel] => actie
[weekdag] => zaterdag
[zaaltitel] => zaal 1
)
[1] => Array
(
[id] => 5
[genretitel] => actie
[weekdag] => zaterdag
[zaaltitel] => zaal 1
)
[2] => Array
(
[id] => 2
[genretitel] => animatie
[weekdag] => zaterdag
[zaaltitel] => zaal 1
)
[3] => Array
(
[id] => 6
[genretitel] => komedie
[weekdag] => zaterdag
[zaaltitel] => zaal 1
)
[4] => Array
(
[id] => 4
[genretitel] => animatie
[weekdag] => zaterdag
[zaaltitel] => zaal 2
)
[5] => Array
(
[id] => 3
[genretitel] => drama
[weekdag] => zaterdag
[zaaltitel] => zaal 2
)
[6] => Array
(
[id] => 8
[genretitel] => science fiction
[weekdag] => zaterdag
[zaaltitel] => zaal 2
)
[7] => Array
(
[id] => 11
[genretitel] => avontuur
[weekdag] => zaterdag
[zaaltitel] => zaal 2
)
[8] => Array
(
[id] => 15
[genretitel] => actie
[weekdag] => zaterdag
[zaaltitel] => zaal 3
)
[9] => Array
(
[id] => 13
[genretitel] => animatie
[weekdag] => zaterdag
[zaaltitel] => zaal 3
)
[10] => Array
(
[id] => 7
[genretitel] => documentaire
[weekdag] => zaterdag
[zaaltitel] => zaal 3
)
[11] => Array
(
[id] => 10
[genretitel] => science fiction
[weekdag] => zaterdag
[zaaltitel] => zaal 3
)
[12] => Array
(
[id] => 12
[genretitel] => actie
[weekdag] => zaterdag
[zaaltitel] => zaal 4
)
[13] => Array
(
[id] => 14
[genretitel] => animatie
[weekdag] => zaterdag
[zaaltitel] => zaal 4
)
[14] => Array
(
[id] => 9
[genretitel] => drama
[weekdag] => zaterdag
[zaaltitel] => zaal 4
)
[15] => Array
(
[id] => 16
[genretitel] => historisch
[weekdag] => zaterdag
[zaaltitel] => zaal 4
)
)
What I would like to have is just the same multidimensional array but without the duplicates.
It looks like you are getting the data from a data base. In that case I would recommend to remove the ID from the select and use something like DISTINCT to avoid duplicates read from the data base.
EDIT: If you really couldn't avoid to have the ID in the select, try the following:
// remove the id from all subarrays
foreach($array as $key => $value){
unset($array[$key]["id"]);
}
// remove all duplictes
$array = array_unique($array);
EDIT: So if you completely want to separate all of the data from the array, to three arrays whitout any corresponing to each other just iterate over the array and make three arrays and use the unique function afterwards:
// create an array for each key
foreach($array as $value){
$genretitel[] = $value["genretitel"];
$weekdag[] = $value["weekdag"];
$zaaltitel[] = $value["zaaltitel"];
}
// remove the duplicates for thos arrays
$genretitel = array_unique($genretitel);
$weekdag= array_unique($weekdag);
$zaaltitel= array_unique($zaaltitel);
If that is even not what you are asking about, please add a example of your desired data after the process.