function age($birthday) { ///ฟังก์ชั่นคำนวณอายุ list($year,$month,$day) = explode("-", $birthday); //$year =$year-543; $datedeb=mktime(0,0,0,$month,$day,$year); $datefin=time(); $aad=date("Y",$datedeb); $mmd=date("m",$datedeb); $jjd=date("d",$datedeb); $aaf=date("Y",$datefin); $mmf=date("m",$datefin); $jjf=date("d",$datefin); $nbj=array(0,31,28,31,30,31,30,31,31,30,31,30,31); if(($aaf % 4)==0){$nbj[2]=29;} if((($aaf % 100)==0)&(($aaf % 400)!=0)){$nbj[2]=28;} if($jjf<$jjd){$jjf=$jjf+$nbj[(int)$mmf];$mmf=$mmf-1;} if($mmf<$mmd){$mmf=$mmf+12;$aaf=$aaf-1;} return ($aaf-$aad)." ปี ".($mmf-$mmd)." เดือน ".($jjf-$jjd)." วัน"; } ?>