As promised, I quote the code of the FROM_DAYS () function translated from the C language, the get_date_from_daynr function implemented in MySQL. <? / ** * * @param $ year year number * @return integer * / private function calc_days_in_year ( $ year ) { return (( $ year & 3 ) == 0 && ( $ year % 100 || ( $ year % 400 == 0 && $ year )))? 366 : 365 ; }
Checked function on coincidence with FROM_DAYS () in the range from 1700 to 2300 I tore the function out of my class, so calls like $ this-> calc_days_in_year ($ year) will not work in an independent function.