PHP method function for retrieving the Constellation corresponding to the birthday

Source: Internet
Author: User
PHP obtains the constellation name corresponding to the specified date. *** obtains the Constellation corresponding to the specified date. *** @ paraminteger $ month 1-12 * @ paraminteger $ day date 1-31 * @ returnboolean | string * publicfunctiongetConstellation ($ mo PHP obtains the constellation name corresponding to the specified date

/*** Obtain the Constellation corresponding to the specified date ** @ param integer $ month 1-12 * @ param integer $ day date 1-31 * @ return boolean | string */public function getConstellation ($ month, $ day) {$ day = intval ($ day); $ month = intval ($ month ); if ($ month <1 | $ month> 12 | $ day <1 | $ day> 31) return false; $ signs = array ('20' => 'trease'), array ('19' => 'pisces '), array ('21' => 'Aries'), array ('20' => 'Taurus '), array ('21' => 'gemine '), array ('22' => 'Loan'), array ('23' => 'Leo '), array ('23' => 'virgo '), array ('23' => 'Libra '), array ('24' => 'Scorpio'), array ('22' => 'Sagittarius '), array ('22' => 'capricorn '); list ($ start, $ name) = each ($ signs [$ month-1]); if ($ day <$ start) list ($ start, $ name) = each ($ signs [($ month-2 <0 )? 11: $ month-2]); return $ name ;}

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.