编辑代码

<?php
//------------------------>位邻和振幅
//百十个的走势图振幅为 邻和振幅时候---->可杀!!!
$formula = array(
    "0 ",
    "1 ",
    "2 ",
    "3 ",
    "4 ",
    "5 ",
    "6 ",
    "7 ",
    "8 ",
    "9 ",
    "10",
    "11",
    "12",
    "13",
    "14",
    "15",
    "16",
    "17",
    "18",
    "振幅",
    "0 ",
    "1 ",
    "2 ",
    "3 ",
    "4 ",
    "5 ",
    "6 ",
    "7 ",
    "8 ",
    "9 "
);



$numbers = ["340","310","478","192","589",
            "542","805","469","758","897",
            "406","377","349","009","469",
            "198","709","642","451","671",
            "213","977","258","041","254",
            "655","336","397","931","775",
            "108","920","899","219","490",
            "532","797","761","457","890",
            "564","071","647","679","257",
            "129","389","620","190","936",
            "594","339","984","579","976",
	        "127","062","432","181","506",
            "206","630","242","075","099",
            "851","989","343","508","549",
            "289","708","183","787","649",
            "323","214","573","067","066",
            "069","652","741","640","035",
            "227","982","955","748","536",
            "256","813","955","816","756",
            "180","225","426","153","356",
            "765","848","287","834","411",
            "180","126","821","212","690",
            "468","164","304","354","145",
            "397","220","752","402","225",
            "480","908","449","236","488",
            "108","460","581","005","918",
            "230","884","443","933","306",
            "579","380","956","530","410",
            "382","676","681","137","725",
            "056","224","710","147","309",
            "843","552","172","390","651",
            "818","892","281","676","449",
            "054","089","009","365","483",
            "444","405","467","305","414",
            "103","564","773","560","884",
            "380","312","298","911","497",
            "938","012","397","715","492",
            "512","274","469","524","065",
            "470","623","955","863","741",
            "710","783","861","449","253",
            "156","086","274","409","096",
            "749","199","077","249","926",
            "766","465","292","710","245",
            "390","227","931","388","699",
            "795","275","833","172","827",
            "086","684","221","060","248",
            "900","983","419","342","718",
            "621","192","839","989","911",
            "426","462","521","364","571",
            "816","372","055","949","666",
            "435","516","336","169","966",
            "296","579","654","539","603",
            "067","754","095","672","802",
            "789","386","525","726","778",
            "542","867","536","384","158",
            "722","280","306","910","167",
            "964","765","951","541","593",
            "964","843","977","509","278",
            "371","483","214","305","317",
            "056","392","928","108","672",
            "657","292","703","916","214",
            "634","085","898","141","260",
            "416","333"];



function zuSan($accnum){
    $tmpArr = array($accnum[0], $accnum[1], $accnum[2]);
    $tArray = array_unique($tmpArr);
    if(count($tArray) == 3){
        return false;    
    }
    return true;    
}

function zhenFu($lastacc, $accnum, $nextnum){
    $num0 = $lastacc + $accnum;
    $num1 = $accnum + $nextnum;
    $zf = abs($num1 - $num0); 
    if($zf > 9){
        $zf = $zf % 10;
    }
    return $zf;    
}



function weiZhiB($index){
    $msg = "";
    $index = $index;
    for($i=0;$i<19;$i++){
        if($index == $i){
            $msg = $msg . '<td style="background-color: green;">' . $i  .  '</td>';
        }else{
            $msg = $msg . "<td></td>";
        }
    }
    
    return $msg;
}

function weiZhiA($index, $bTrue){
    $msg = "";
    $index = $index;
    for($i=0;$i<10;$i++){
        if($index == $i){
            if($bTrue == true){
                $msg = $msg . '<td style="background-color: red;">' . $i  .  '</td>';
            }else{
                $msg = $msg . '<td style="background-color: green;">' . $i  .  '</td>';
            }
        }else{
            $msg = $msg . "<td></td>";
        }
    }
    
    return $msg;
}

function weiZhi($index){
    $msg = "";
    $index = $index;
    for($i=0;$i<10;$i++){
        if($index == $i){
            $msg = $msg . '<td style="background-color: green;">' . $i  .  '</td>';
        }else{
            $msg = $msg . "<td></td>";
        }
    }
    
    return $msg;
}


for($x=0;$x<3;$x++){
    echo '<table width="700" height="100" border="1" cellpadding="0" cellspacing="0">';
        // 3. 输出表头
    $name = "";
    if($x==0){
        $name = "百位";
    }else if($x==1){
        $name = "十位";
    }else if($x==2){
        $name = "个位";
    }
    echo '<thead><tr><th>' . $name .  '   开奖号' . '</th>';
    foreach ($formula as $item){
        echo '<th>' . $item . '</th>';
    }
    echo '</tr></thead>';
    // 4. 输出表格内容
    echo '<tbody>';
    $length = count($numbers);
    for ($i=0;$i<$length;$i++){
        //5. 输出一行数据
        echo '<tr>';
        echo '<td>' . $numbers[$i] . '</td>';
        if($i<=1){
            continue;
        }
        $outputMsg =  weiZhiB($numbers[$i-2][$x]+$numbers[$i-1][$x]);
        echo $outputMsg;

        if($i > 0){
            echo '<td></td>';
            $tmpArr = array($numbers[$i-1][0],$numbers[$i-1][1],$numbers[$i-1][2]);
            sort($tmpArr);
            $kua = $tmpArr[2] - $tmpArr[0];
            if(($numbers[$i-2][$x]+$numbers[$i-1][$x] + $kua) == $numbers[$i][$x] || abs($numbers[$i-2][$x]+$numbers[$i-1][$x] - $kua) == $numbers[$i][$x] ){
                $outputMsg1 =  weiZhiA($kua, true);
                echo $outputMsg1;
            }else{
                $outputMsg1 =  weiZhiA($kua, false);
                echo $outputMsg1;
            }
        }

        echo '</tr>';
    }
    echo '</tbody>';
    echo '</table>';
    echo "\n";
    echo "\n";
    echo "\n";
    echo "\n";
    echo "\n";
    echo "\n";


}




echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
echo "\n";
?>