I have this Array :
Array (
[0] => Array ( [x] => 2016-04-19 )
[1] => Array ( [x] => 2016-05-25 )
[2] => Array ( [x] => 2016-05-26 )
[3] => Array ( [x] => 2016-05-27 )
[4] => Array ( [x] => 2016-05-28 )
[5] => Array ( [x] => 2016-05-29 )
[6] => Array ( [x] => 2016-05-29 )
[7] => Array ( [x] => 2016-06-02 )
[8] => Array ( [x] => 2016-06-03 )
[9] => Array ( [x] => 2016-06-07 )
[10] => Array ( [x] => 2016-06-10 )
[11] => Array ( [x] => 2016-06-17 )
[12] => Array ( [x] => 2016-06-24 ) )
I'm trying to count how many days are duplicates and get this number in a variable. For example as we can see there are 2 same dates:
2016-05-29
I've tried array_count_values() but it says it can only count strings and integers. That's correct because this is a Date variable. This is it's code:
$eventDates = $object->get("date");
$result = $eventDates->format("Y-m-d");
$data[] = array("x"=>$result);
Any idea of how to count them?
array_mapto create a string from each date value so that I could usearray_count_values.