I would like to generate each dates (timestamp) that start now, on every monday, at a specific time, say 16h30, 17h00 and 14h00.
This code almost works, but the hour is the current one, instead of $hours[$i], and it’s also the current day of the week instead of the next monday
$hours = array('16h30', '17h00', '14h00');
for ($i = 0; $i < 3; $i++) {
// how to specify the hour $hours[$i] ?
$dates[] = strtotime("+$i weeks 0 days");
}
Desired output:
monday 5 november, 16h30
monday 12 november, 16h30
monday 19 november, 16h30
...
If you remove the ‘h’ from the times, PHP will understand them as-is, and you can just put the weekday name in the string.
If you need the
hfor the rest of the code, you can remove it for just this purpose: