PHP _php Tutorials For judging the function of constellations based on specific dates

Source: Internet
Author: User

PHP to determine the function of a constellation based on a specific date


Now it's kind of popular to discuss constellations, the following authors share a function that uses PHP to determine which constellation a date belongs to. The specific function code is as follows:

function constellation ($month, $day) {//Check parameter validity http://www.phpernote.com/if ($month <1| | $month >12| | $day <1| | $day >31) return false;//constellation name and start date $constellations=array ("+" and "Aquarius"), Array ("+" + "Pisces"), Array ("21 "=" and "Aries"), Array ("+" and "Taurus"), Array ("+" and "Gemini"), Array ("+" and "cancer"), Array ("Max" = "Leo"), Array ("23 "=" and "Virgo"), Array ("+" = "Libra"), Array ("+" and "Scorpio"), Array ("+" and "Sagittarius"), Array ("+" = "Capricorn"); List ($ Constellation_start, $constellation _name) =each ($constellations [(int) $month-1]); if ($day < $constellation _start) {List ($constellation _start, $constellation _name) =each ($constellations [($month -2<0)? $month =11: $month-=2]);} return $constellation _name;}

Example of a function call:

Echo Constellation (4, 20);

Articles you may be interested in

    • Php method for retrieving Ganzhi, Zodiac and constellation information based on date or time stamp
    • PHP Extract the birthday date from the ID number and the function to verify whether it is a minor
    • PHP calculates the function of two dates apart, how many months, how many days
    • PHP calculates the number of days (day) of a two-date function
    • PHP Digital Judgment function
    • How PHP determines if a GIF is a dynamic picture (animated)
    • PHP gets a method for each month in a certain period of time, returning an array of these months
    • PHP calculates a function that is currently the first week of the year or January

http://www.bkjia.com/PHPjc/919715.html www.bkjia.com true http://www.bkjia.com/PHPjc/919715.html techarticle PHP's function of judging constellations based on specific dates now seems to be quite popular for discussion constellations, the following authors share a function that uses PHP to determine which constellation the specified date belongs to. Specific function generation ...

  • 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.