私はコーディングとphpの世界に不慣れで、関数strtotime
とmktime
関数が異なる結果を返す理由に混乱しています。
$endyear = date('Y', strtotime('+5 years')); //returns 2011 - 2015
$endyear = date('Y', mktime(0,0,0,0,0,$year+5)); //returns 2011 - 2014
編集
変数$yearの値は$2011です。
月と日の引数にゼロを使用しています。これは基本的に
Day 0 = Last day of the previous month
Month 0 = Last month of the previous year
それはすべてドキュメントにあります-http://php.net/manual/en/function.mktime.php