HI!
I have an array with dates in the keys and ids in the corresponding values. Some of the values are unique, some of them are repeating. Example:
$arr = (
"1999-01-01" => "2",
"1999-01-02" => "2",
"1999-01-03" => "2",
"1999-01-03" => "3",
"1999-01-03" => "4",
"2000-01-03" => "4",
"2001-01-03" => "4"
);
What I want is if the value is not unique i the array to get only the pair key => value with the latest date, and of course if the value is unique, to get it with its key. So the array I want to get from this is:
$arr_I_need = (
"1999-01-03" => "2",
"1999-01-03" => "3",
"2001-01-03" => "4"
);
Can somebody think out a functinon for that... I have been thinking hours, but got to nothing.
10x in advance
PS the date format is yyyy-mm-dd like the one used in strtotime();