Something I just put together for a Magic Parser customer which might come in handy for someone, somewhere! A PHP function to return the current star sign of the Zodiac (or the star sign of any given date as a PHP time() value), taking leap years into account.
<?php
function getStarSign($date="")
{
$zodiac[356] = "Capricorn";
$zodiac[326] = "Sagittarius";
$zodiac[296] = "Scorpio";
$zodiac[266] = "Libra";
$zodiac[235] = "Virgo";
$zodiac[203] = "Leo";
$zodiac[172] = "Cancer";
$zodiac[140] = "Gemini";
$zodiac[111] = "Taurus";
$zodiac[78] = "Aries";
$zodiac[51] = "Pisces";
$zodiac[20] = "Aquarius";
$zodiac[0] = "Capricorn";
if (!$date) $date = time();
$dayOfTheYear = date("z",$date);
$isLeapYear = date("L",$date);
if ($isLeapYear && ($dayOfTheYear > 59)) $dayOfTheYear = $dayOfTheYear - 1;
foreach($zodiac as $day => $sign) if ($dayOfTheYear > $day) break;
return $sign;
}
?>To get the current star sign (today's date), simply use
$sign = getStarSign();
...or for the star sign of any given date, provide a standard time() value, e.g.
$sign = getStarSign(strtotime("2007-03-25"));

