Ben Perry childhood php get Nadia and common year number of days code

Source: Internet
Author: User
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.