Copy CodeThe code is as follows:
//Gets the number of days that can be used for any month
function getDays ($month, $year)
{
switch ($month)
{
Case 4:
Case 6:
CA SE 9:
Case one by one:
$days = 30;
break;
Case 2:
if ($year%4==0)
{
if ($year 0==0)
{
$days = $year @0==0? 29:28;
}
Else
{
$days = 29;
}
}
Else
{
$days = 28;
}
Break;
Default:
$days = 31;
break;
}
Return $days;
}
* *
* to get the corresponding day of the week based on timestamp
*
* @param int $time _stamp timestamp
*/
Function Getweek ($time _stamp)
{
$week _num = Date ("W", $time _stamp);
Switch ($week _num)
{
Case "0":
$week = "Day";
break;
Case ' 1 ':
$week = "one";
break;
Case ' 2 ':
$week = "two";
break;
Case ' 3 ':
$week = "three";
break;
Case ' 4 ':
$week = "four";
break;
Case ' 5 ':
$week = "Five";
break;
Case ' 6 ':
$week = "Six";
break;
}
Return $week;
}
The above introduces the class of the childhood php Nadia and common year the number of days of the code, including the childhood aspects of the class, I hope that the PHP tutorial interested in a friend helpful.