PHP strtotime and mktime return different results
I am new to开发者_Go百科 the world of coding as well as php and am confused by why the strtotime
and mktime
functions return different results e.g.
$endyear = date('Y', strtotime('+5 years')); //returns 2011 - 2015
$endyear = date('Y', mktime(0,0,0,0,0,$year+5)); //returns 2011 - 2014
EDIT
The variable $year has the value of $2011.
You're using zeroes for the month and day arguments, this essentially means
Day 0 = Last day of the previous month
Month 0 = Last month of the previous year
It's all there in the documentation - http://php.net/manual/en/function.mktime.php
精彩评论