array() is not a typecasting function, so if $startDates is sometimes an array like it’s supposed to be, this will encapsulate that array in another and the function won’t work.
yes array is not a typecasting function. but we can make element an part of an array using like:
<?php
$startDate = '2010-01-14';
echo $startDate; //just a string
$new_array = array($startDate); //becomes an part of the array
print_r($new_array);
?>