Can anybody explain how to take this array:
array(
'Anto' => 25,
'Filip' => 22,
'Marko' => 17,
'Josip' => 23,
'Igor' => 24,
'Ivan' => 23,
);
And map it like this:
array(
17 => [1, 'Marko'],
22 => [1, 'Filip'],
23 => [2, 'Josip', 'Ivan'],
24 => [1, 'Igor'],
25 => [1, 'Anto'],
);
The new array contains keys that are the age (from the value of the initial array) and the value is an array containing the number of people with the same age followed by all names with the same age.