function moon_cycle ($date
{
$d = getdate$date);
$year = $d'year'];
$month = $d'mon'];
$day = $d'mday'];
$r = $year % 100;
$r %= 19;
if ($r>9)
$r -= 19;
$r = (($r * 11) % 30) + $month + $day
if ($month<3)
$r += 2;
$r -= (($year<2000) ? 4 : 8.3);
$r = floor$r+0.5)%30;
return ($r < 0) ? $r+30 : $r
}