You can use the strtotime function in PHP to calculate future dates. To get the date for the next three days, you can use the following code:

bashCopy code$today = time();

for ($i = 1; $i <= 3; $i++) {
  $next_day = strtotime("+$i day", $today);
  echo date('Y-m-d', $next_day) . "\n";
}

This code sets a $today variable to the current time, then uses a loop to calculate the date for each of the next three days. The strtotime function is used to add a specified number of days to the current time. The resulting time is then passed to the date function to format it as a Y-m-d string.

(Visited 11 times, 1 visits today)
Was this article helpful?
YesNo
Close Search Window