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 ;}