PHP: Get zodiac sign by date
- function getZodiacSign($birth_date) {
- $bd = explode("-", $birth_date);
- $daymonth = $bd[1] . "-" . $bd[2];
- if ($daymonth >= '01-21' and $daymonth <= '02-20') {
- $zodiac = 'Aquarius';
- } elseif ($daymonth >= '02-21' and $daymonth <= '03-20') {
- $zodiac = 'Pisces';
- } elseif ($daymonth >= '03-21' and $daymonth <= '04-20') {
- $zodiac = 'Aries';
- } elseif ($daymonth >= '04-21' and $daymonth <= '05-20') {
- $zodiac = 'Taurus';
- } elseif ($daymonth >= '05-21' and $daymonth <= '06-21') {
- $zodiac = 'Gemini';
- } elseif ($daymonth >= '06-22' and $daymonth <= '07-22') {
- $zodiac = 'Cancer';
- } elseif ($daymonth >= '07-23' and $daymonth <= '08-23') {
- $zodiac = 'Leo';
- } elseif ($daymonth >= '08-24' and $daymonth <= '09-23') {
- $zodiac = 'Virgo';
- } elseif ($daymonth >= '09-24' and $daymonth <= '10-23') {
- $zodiac = 'Libra';
- } elseif ($daymonth >= '10-24' and $daymonth <= '11-22') {
- $zodiac = 'Scorpio';
- } elseif ($daymonth >= '11-23' and $daymonth <= '12-21') {
- $zodiac = 'Sagittarius';
- } else {
- $zodiac = 'Capricorn';
- }
- return $zodiac;
- }
- //Will return "Aquarius"
- echo getZodiacSign('1982-08-27');
Комментариев нет:
Отправить комментарий