I have an array of dates; I want that if there is a duplicate date, it shows me only the first duplicate date without repeating the other duplicates.
So if I have the following array:
array: [
0 => "2024-08-16"
1 => "2024-08-11"
2 => "2024-08-16"
3 => "2024-09-05"
4 => "2024-08-01"
5 => "2024-08-02"
6 => "2024-08-03"
7 => "2024-08-04"
8 => "2024-08-05"
9 => "2024-08-06"
10 => "2024-08-07"
11 => "2024-08-08"
12 => "2024-08-09"
13 => "2024-08-10"
14 => "2024-08-11"
15 => "2024-08-12"
16 => "2024-08-13"
17 => "2024-08-14"
18 => "2024-08-15"
19 => "2024-08-16"
20 => "2024-08-17"
21 => "2024-08-18"
22 => "2024-08-19"
23 => "2024-08-20"
24 => "2024-08-21"
]
I want to get the result below:
array: [
0 => "2024-08-16"
1 => "2024-08-11"
2 => ""
3 => "2024-09-05"
4 => "2024-08-01"
5 => "2024-08-02"
6 => "2024-08-03"
7 => "2024-08-04"
8 => "2024-08-05"
9 => "2024-08-06"
10 => "2024-08-07"
11 => "2024-08-08"
12 => "2024-08-09"
13 => "2024-08-10"
14 => ""
15 => "2024-08-12"
16 => "2024-08-13"
17 => "2024-08-14"
18 => "2024-08-15"
19 => ""
20 => "2024-08-17"
21 => "2024-08-18"
22 => "2024-08-19"
23 => "2024-08-20"
24 => "2024-08-21"
]
Since ‘2024-08-16’ and ‘2024-08-11’ are repeated.
Can someone please help me?
1