|
[Font = Arial] <? Php [/font]
[Font = Arial]/**
* Calculate the Constellation based on the month and date of the birthday.
*
* @ Param int $ birth_month
* @ Param int $ birth_date
* @ Return string
*/
Function get_constellation ($ birth_month, $ birth_date)
{
// When judging, in order to avoid doubts such as "1" and "true", or whether the judgment statement is always true, it is processed as a string.
$ Birth_month = strval ($ birth_month );
$ Constellation_name = array (
'Aquarius ', 'pisces', 'aries ', 'Taurus', 'gemine', 'Cancer ',
'Leo ', 'virgo', 'Libra ', 'Scorpio)', 'Sagittarius ', 'capricorn'
);
If ($ birth_date <= 22)
{
If ('1 '! = $ Birth_month)
{
$ Constellation = $ constellation_name [$ birth_month-2];
}
Else
{
$ Constellation = $ constellation_name [11];
}
}
Else
{
$ Constellation = $ constellation_name [$ birth_month-1];
}
Return $ constellation;
} [/Font]
[Font = Arial]/**
* Calculate the Chinese zodiac based on the year in the birthday.
*
* @ Param int $ birth_year
* @ Return string
*/
Function get_animal ($ birth_year)
{
// The year 1900 is the year of the mouse
$ Animal = array (
'Zombies ', 'ugly niu', 'Tigers', 'rabbits, 'Chen long', 'Snakes ',
'Afternoon M', 'goat ', 'Monkey Shen', 'youzichen ', 'Pig', 'Pig pig'
);
$ My_animal = ($ birth_year-1900) % 12;
Return $ animal [$ my_animal];
} [/Font] |