国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home php教程 PHP源碼 一個(gè)判斷干支、屬相和星座的php函數(shù)

一個(gè)判斷干支、屬相和星座的php函數(shù)

May 25, 2016 pm 05:05 PM

一個(gè)判斷干支、屬相和星座的php函數(shù)?-?不足的是?星座應(yīng)該是區(qū)分公歷算的~~??有待改進(jìn)

php代碼

$arr = birthext ( '474768000' ); //時(shí)間戳
print_r ( $arr );
$arr = birthext ( '1985-01-17' );
print_r ( $arr );
$arr = birthext ( '19850117' );
print_r ( $arr );

php代碼:

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 ( &#39;-&#39;, $birth );  
    if (count ( $tmpstr ) !== 3)
        return false;
     
    $y = ( int ) $tmpstr [0];
    $m = ( int ) $tmpstr [1];
    $d = ( int ) $tmpstr [2];
    $result = array ();
    $xzdict = array (&#39;摩羯&#39;, &#39;水瓶&#39;, &#39;雙魚(yú)&#39;, &#39;白羊&#39;, &#39;金牛&#39;, &#39;雙子&#39;, &#39;巨蟹&#39;, &#39;獅子&#39;, &#39;處女&#39;, &#39;天秤&#39;, &#39;天蝎&#39;, &#39;射手&#39; );
    $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 [&#39;xz&#39;] = $xzdict [$i] . &#39;座&#39;;    
    $gzdict = array (array (&#39;甲&#39;, &#39;乙&#39;, &#39;丙&#39;, &#39;丁&#39;, &#39;戊&#39;, &#39;己&#39;, &#39;庚&#39;, &#39;辛&#39;, &#39;壬&#39;, &#39;癸&#39; ), array (&#39;子&#39;, &#39;丑&#39;, &#39;寅&#39;, &#39;卯&#39;, &#39;辰&#39;, &#39;巳&#39;, &#39;午&#39;, &#39;未&#39;, &#39;申&#39;, &#39;酉&#39;, &#39;戌&#39;, &#39;亥&#39; ) );
    $i = $y - 1900 + 36;
    $result [&#39;gz&#39;] = $gzdict [0] [($i % 10)] . $gzdict [1] [($i % 12)]; 
    $sxdict = array (&#39;鼠&#39;, &#39;牛&#39;, &#39;虎&#39;, &#39;兔&#39;, &#39;龍&#39;, &#39;蛇&#39;, &#39;馬&#39;, &#39;羊&#39;, &#39;猴&#39;, &#39;雞&#39;, &#39;狗&#39;, &#39;豬&#39; );
    $result [&#39;sx&#39;] = $sxdict [(($y - 4) % 12)];
    return $result;
}
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)