This article mainly introduces how many days php still has to compute to a specified date. it involves php operation time techniques and is very useful, for more information, see the example in this article to describe how many days php calculates to the specified date. Share it with you for your reference. The details are as follows:
Function countdays ($ d) {$ olddate = substr ($ d, 4); $ newdate = date (Y ). "". $ olddate; $ nextyear = date (Y) + 1. "". $ olddate; if ($ newdate> date ("Y-m-d") {$ start_ts = strtotime ($ newdate ); $ end_ts = strtotime (date ("Y-m-d"); $ diff = $ end_ts-$ start_ts; $ n = round ($ diff/86400 ); $ return = substr ($ n, 1); return $ return;} else {$ start_ts = strtotime ($ nextyear ); $ end_ts = strtotime (date ("Y-m-d"); $ diff = $ end_ts-$ start_ts; $ n = round ($ diff/86400 ); $ return = substr ($ n, 1); return $ return ;}}
I hope this article will help you with php programming.