PHP: how to determine the Constellation function based on a specific date-PHP Tutorial

Source: Internet
Author: User
PHP determines the Constellation function based on the specific date. PHP determines the Constellation function based on the specific date. it seems very popular now to discuss the constellation. The author will share a function that uses PHP to determine which constellation a date belongs. The specific function is used to determine the Constellation function based on the specific date on behalf of PHP.

It seems that Constellation discussion is quite popular now. The author will share a function that uses PHP to determine which Constellation belongs to a specified date. The specific function code is as follows:

Function constellation ($ month, $ day) {// Check the parameter validity http://www.phpernote.com/if ($ month <1 | $ month> 12 | $ day <1 | $ day> 31) return false; // constellation name and start date $ constellations = array ("20" => "Baodi"), array ("19" => "Pisces "), array ("21" => "Aries"), array ("20" => "Taurus"), array ("21" => "Gemini "), array ("22" => "cancer"), array ("23" => "Leo"), array ("23" => "Virgo "), array ("23" => "Libra"), array ("24" => "Scorpio"), array ("22" => "Sagittarius "), array ("22" => "Capricorn"); list ($ constel Lation_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 ;}

Function call example:

echo constellation(4, 20);
Articles you may be interested in
  • How to obtain information about the year, Zodiac, and Constellation of the rule by using the date or timestamp in php
  • Php extracts the birthday date from the ID card number and verifies whether it is a minor.
  • Php calculates the number of years, months, and days between two dates.
  • Php calculates the number of days of the difference between two dates.
  • PHP numeric judgment function
  • How does PHP determine whether a GIF image is a dynamic image (animation)
  • Php gets the method of each month in a certain period of time, and returns an array composed of these months
  • Php calculates the number of weeks in a year or January.

The author now seems to be quite familiar with the constellation discussion. The author will share a function that uses PHP to determine which Constellation belongs to a specified date. 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.