Mistři v programování na #hovnokod

PHP #1079

Kod po nejakem zdrogovanem programatorovi, nenapadlo ho pouzit DATETIME a vytvoril si nejaky vlastni datestamp, takhle to potom formatoval do "citelneho" tvaru.

<?php
 
function datestamp_parts($datestamp=0) {
  if($datestamp && ($datestamp < 11967900)) {
		$yd= ((365)+($datestamp-((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))*(365))))-(floor(((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))-1)/4)-(floor(((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))-1)/100)-floor(((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))-1)/400)));
		$y = (ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365));
		$l = ((floor((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))/4)-(floor((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))/100)-floor((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))/400)))-(floor(((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))-1)/4)-(floor(((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))-1)/100)-floor(((ceil(($datestamp-((floor((($datestamp/365)/4)-floor(($datestamp/365)/100)+floor(($datestamp/365)/400)))))/365))-1)/400))));
		if((!$l && $yd>365)) {
			$yd=$yd-365;
			$y++;
			$l=1;
		} elseif($l && $yd>366) {
			$yd=$yd-366;
			$y++;
			$l=0;
		}
		$uy = $l ? 2000 : 2001;
		$m = date("n",mktime(1,1,1,1,$yd,$uy));
		$md = date("j",mktime(1,1,1,1,$yd,$uy));
		$out['year'] = $y;
		$out['month'] = $m;
		$out['month_day'] = $md;
		$out['leapyear'] = $l;
		$out['year_day'] = $yd;
		return $out;
	} else {
		return false;
	}
}

Anonymous,