Zodiac Earthly branches, referred to as "Ganzhi", this is the ancient Chinese calendar, the following use of PHP to implement a Zodiac earthly calculator, the need for friends can refer to the next
Zodiac, referred to as "Ganzhi". In the ancient Chinese calendar, a, B, C, Ding, E, self, Geng, Xin, Ren, GUI is known as "10 days dry", son, Ugly, Yin, Mao, Chen, Wu, noon, not, Shen, unitary, Xu, Hai is called "12 Earthly Branches." The ten-Dry and 12-branch matching in turn, constitute 60 basic units, the two in a fixed order of coordination with each other, formed the Ganzhi Ji method. From the tomb unearthed from the tomb of the Oracle, Zodiac in ancient China used mainly for Ji day, in addition to Guile, Annals, Manes and so on. Zodiac support algorithm 1 zodiac support algorithm: one. A.D.: Zodiac: a 4 B 5 c 6 Ding 7 pentyl 8 9 Geng 0 Xin 1-decyl 3 such as the end of 1894 a number is 2 in the year, and so on : son 4 ugly 4 Yin 5 Mao 7 Chen 8 9 noon 10 not 11 Shen 0 unitary 1 Xu 2 hai 3 conversion: 1894 divided by 12, the remainder is a few, on the support of a few two. BC: Zodiac: a 7 B 6, 5, 4, 3, 2, 1, 0, 9, 8 , as in the year before 7. This analogy support: sub-9 ugly-8 Yin-7 MAO-6 Chen-5-4 Noon-3 non-2 Shen-1 unitary 0 XU-11 hai-10 conversion: such as 221 BC, 221 divided by 12, the remainder is a few, in the support to find a few code as follows: <?PHP$TG DZ = Array (Array (' A ', ' B ', ' C ', ' ding ', ' e ', ' self ', ' g ', ' xin ', ' Ren ', ' gui '), array (' son ', ' ugly ', ' Yin ', ' Mao ', ' Chen ', ' ji ', ' noon ', ' not ', ' Shen ', ' unitary ', ' Xu ', ' Hai '), $Year = $Year _jisuan = $Year -1900 + +; $TianGanDiZhi = $TGDZ [0][$Year _jisuan% 10]. $TGDZ [1][$Year _jisuan% 12];echo $Year. " Year for lunar calendar [". $TianGanDiZhi."] Years ";? The > Zodiac support algorithm 2 code is as follows: <?php$tgdz = Array (' g ', ' xin ', ' ren ', ' decyl ', ' A ', ' B ', ' C ', ' ding ', ' e ', ' own '), a Rray (' Shen ', ' unitary ', ' Xu ', ' Hai ', ' son ', ' ugly ', ' Yin '', ' Mao ', ' Chen ', ' have ', ' noon ', ' not ')); for ($Year = 1900; $Year <= 2099; $Year + +) { $TianGanDiZhi = $TGDZ [0][$Year% 1 0]. $TGDZ [1][$Year% 12];echo $Year. "Year is the lunar calendar [". $TianGanDiZhi. "Year <br>";}? >
PHP implementation Zodiac earthly Calculator sample PHP fortune Teller program