Thursday, September 17, 2009

PHP: Functions For Giving Birth

These are two functions I found in my archives that I had written several years ago and felt like posting.  I’m sure there are others out on the Internet, maybe even better ones.  Who cares.  Here goes…


function ZodiacSign($date){
list($year,$month,$day)=explode("-",$date);
if (($month==1 && $day>20)||($month==2 && $day<20)) {
return "Aquarius";
} else if (($month==2 && $day>18 )||($month==3 && $day<21)) {
return "Pisces";
} else if (($month==3 && $day>20)||($month==4 && $day<21)) {
return "Aries";
} else if (($month==4 && $day>20)||($month==5 && $day<22)) {
return "Taurus";
} else if (($month==5 && $day>21)||($month==6 && $day<22)) {
return "Gemini";
} else if (($month==6 && $day>21)||($month==7 && $day<24)) {
return "Cancer";
} else if (($month==7 && $day>23)||($month==8 && $day<24)) {
return "Leo";
} else if (($month==8 && $day>23)||($month==9 && $day<24)) {
return "Virgo";
} else if (($month==9 && $day>23)||($month==10 && $day<24)) {
return "Libra";
} else if (($month==10 && $day>23)||($month==11 && $day<23)) {
return "Scorpio";
} else if (($month==11 && $day>22)||($month==12 && $day<23)) {
return "Sagittarius";
} else if (($month==12 && $day>22)||($month==1 && $day<21)) {
return "Capricorn";
}
}

function BirthStone($iMonth) {
switch($iMonth) {
case 1:
return "Garnet";
case 2:
return "Amethyst";
case 3:
return "Aquamarine";
case 4:
return "Diamond";
case 5:
return "Emerald";
case 6:
return "Pearl";
case 7:
return "Ruby";
case 8:
return "Peridot";
case 9:
return "Sapphire";
case 10:
return "Opal";
case 11:
return "Topaz";
case 12:
return "Turquoise";
}
}

// examples:
$my_birth_stone = BirthStone(3);

$my_birth_sign = ZodiacSign('1955-03-31');

No comments: