-
-
function yige_constellation($month, $day) { - // Check parameter validity
- if ($month < 1 || $month > 12 || $ day < 1 || $day > 31) return false;
// Constellation name and start date
- $constellations = array(
- array( "20" => "Aquarius" ),
- array( "19" => "Pisces"),
- array( "21" => "Aries"),
- array( "20" => "Taurus"),
- array( "21" => "Gemini"),
- array( "22" => "Cancer"),
- array( "23" => "Leo"),
- array( "23" => "Virgo") ,
- array( "23" => "Libra"),
- array( "24" => "Scorpio"),
- array( "22" => "Sagittarius"),
- array( "22" => "Capricorn")
- );
list($constellation_start, $constellation_name) = each($constellations[(int)$month-1]);
-
if ($day < $constellation_start) list($constellation_start, $constellation_name) = each($constellations[($month -2 < 0) ? $month = 11: $month -= 2]);
return $constellation_name;
- }
//Call:
- echo yige_constellation(4, 20);
-
Copy code
|