You will need to learn strtotime () . I would suggest that your last code would look something like this:
$currentDate = strtotime('today');//your date variable goes here $futureDate = date('Ym-d', strtotime('+ 2 days', $currentDate)); echo $futureDate;
Live demo
If you are using PHP version> = 5.2, I highly recommend that you use the new DateTime object. For example, as shown below:
$futureDate = new DateTime("today"); $futureDate->modify("+2 days"); echo $futureDate->format("Ymd");
Live demo
source share