Hello to everyone i'm new to PHP... with this function i have the name of the days between two dates, but i can't translate it in italian without broken it. Can someone help me? I tried to use strftime() in this two modes, but it gives me the error: strftime() expects parameter 2 to be int, object given, i have done the var_dump of date and it is object, I need to cast it or it is not the answer to my question?
$from_date = new DateTime($from_date);
$to_date = new DateTime($to_date);
for ($date = $from_date; $date <= $to_date; $date->modify('+1 day')) {
echo $date->format('l') . "\n";
//echo strftime("%A", $date); error : strftime() expects parameter 2 to be int, object given
//var_dump($date); object(DateTime)
}
output: Wednesday Thursday Friday
I pick $from_date and $to_date from :
+------------+------------+
| from_date | to_date |
+============+============+
| 2020-04-01 | 2020-04-03 |
+------------+------------+