PHP Constellation _php Tutorials For information such as constellation information and zodiac signs based on date or time stamp

Source: Internet
Author: User

PHP gets constellation information and zodiac information based on date or time stamp, PHP constellation


Share a function method that uses PHP to obtain the corresponding Ganzhi, Zodiac, and constellation information based on date or time stamp, the specific function code, and how to use it as follows:

/** Judge Ganzhi, Zodiac and constellation */function Birthext ($birth) {if (Strstr ($birth, '-') ===false&&strlen ($birth)!==8) {$birth =date  ("y-m-d", $birth); if (strlen ($birth) ===8) {if (Eregi (' ([0-9]{4}) ([0-9]{2}) ([0-9]{2}] $ ', $birth, $bir)) $birth = "{$bir [1]}-{$bir [2]}-{$  BIR[3]} ";  } if (strlen ($birth) <8) {return false;  } $tmpstr = Explode ('-', $birth);  if (count ($tmpstr)!==3) {return false;  } $y = (int) $tmpstr [0];  $m = (int) $tmpstr [1];  $d = (int) $tmpstr [2];  $result =array ();  $xzdict =array (' Capricorn ', ' Aquarius ', ' Pisces ', ' White Sheep ', ' Taurus ', ' Gemini ', ' cancer ', ' lions ', ' virgins ', ' Libra ', ' Scorpio ', ' Shooter ');  $zone =array (1222,122,222,321,421,522,622,722,822,922,1022,1122,1222); if ((100* $m + $d) >= $zone [0]| |  (100* $m + $d) < $zone [1]) {$i = 0;   }else{for ($i =1, $i <12; $i + +) {if ((100* $m + $d) >= $zone [$i]&& (100* $m + $d) < $zone [$i +1]) {break;} }} $result [' XZ ']= $xzdict [$i]. '  Seat '; $gzdict =array (Array (' A ', ' B ', ' C ', ' ding ', ' e ', ' self ', ' g ', ' xin ', ' ren ', ' decyl ', Array (' son ', ' ugly ', ' Yin ', ' Mao ', ' Chen ', ' ' "') ', ' noon ', ' not ', ' shen ', ' unitary ', ' Xu '  , ' Hai ')); $i = $y -1900+36; $result [' GZ ']= $gzdict [0][($i%]. $gzdict [1][($i%12)];  $sxdict =array (' rat ', ' ox ', ' tiger ', ' Rabbit ', ' dragon ', ' snake ', ' horse ', ' sheep ', ' monkey ', ' chicken ', ' dog ', ' pig ');  $result [' SX ']= $sxdict [(($y-4)%12)]; return $result; }

The

Use instance is as follows:

<?php header ("Content-type:text/html;charset=utf-8"); Echo ' 
 

Print the results as follows:

Above is a function of PHP to obtain constellation information based on date or time stamp and other information such as Zodiac signs , hoping to help you with your study.

http://www.bkjia.com/phpjc/1063236.html www.bkjia.com true Span id= "Isbasedonurl" itemprop= "Isbasedonurl" >http://www.bkjia.com/phpjc/1063236.html techarticle php get constellation Information and zodiac information based on date or time stamp, PHP constellation Share a function that uses PHP to obtain the corresponding Ganzhi, Zodiac, and constellation information based on date or time stamp ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.