PHP: Finding The Total Number of Days in Year

Fri, 08/16/2013 - 09:31 -- Arisen

Did you ever want to find the number of days in year? Maybe you need to calculate the totals days or make sure that you've taken in account for leap years. Here's a quick solution to do just that:

<?php
// get number days of year for 2008
// result 366
echo date("z", mktime(0,0,0,12,31,2008)) + 1;
?>