Good afternoon I have the following date arrangement
$fecha = array('2020-02-09', '2020-03-09', 'Sin fecha', '2020-04-09');
$fecha_final ="";
What I want to achieve is to compare the 4 to obtain the largest date between them and store it in a final date variable.
I thought of putting it in a for like this
for ($i = 0; $i < count($fecha); $i++) {
$datetime1 = date_create($fecha[0]);
$datetime2 = date_create($fecha[1]);
}
and go compared one by one but I still do not land the idea well, I hope you can help me
I recommend replacing the dateless data with "0000-00-00":
If you don't want to remove the 'No date' data from the array, this would be another option: