php - Add variable number of days to date -


how add variable number of days date in php? i've found examples calculating specific number of days, not variable.

$date = $row["date"]; // i.e 2015-12-13 $days = $row["days"]; // i.e 10 

i want output (in example 2015-12-23) put in variable $futuredate.

thanks!

you can try strtotime() , date() functions

$date = $row['date']; $days = $row['days']; $futuredate = date('y-m-d',strtotime($date) + (24*60*60*$days)); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -