Need to get the last day of any given month? Everyone occasionally does, here’s how.\r\nExample:\r\n\r\n02-2012 = \r\n\r\n = \r\n\r\n
\r\nfunction lastday($month = '', $year = '')\r\n{\r\n	if(empty($month))\r\n    {\r\n    	$month = date('m');\r\n    }\r\n    if(empty($year))\r\n    {\r\n    	$year = date('Y');\r\n    }\r\n    $result = strtotime("{$year}-{$month}-01");\r\n    $result = strtotime('-1 second', strtotime('+1 month', $result));\r\n    return date('Y-m-d', $result);\r\n}\r\necho lastday(05, 2009);\r\n