趣味游戏【0101】

<?php
error_reporting(E_ALL);

$new_arr = [];
for ($i = 1; $i <= 100; ++$i) {
    $y = (string)$i;
    $b = strpos($y, '5');
    if ($b !== false) {
        array_push($new_arr, $i);    
    } else {
        $a = $i%5;
        if ($a === 0) {
            array_push($new_arr, $i);    
        }
    }
}

$arr_n = [2, 3];

for ($i=0, $j =0; $i < count($new_arr); ++$i,++$j) {
    $m = $j%2;
    $num = $arr_n[$m];
    for ($n = 0; $n < $num && $i < count($new_arr); ++$n,++$i) {
        echo $new_arr[$i];
        echo ' ';
    }
    echo '<br />';
}

?>

 

posted @ 2018-10-30 18:13  绝技小嗨皮  阅读(155)  评论(0编辑  收藏  举报
Title