晴明的博客园 GitHub      CodePen      CodeWars     

[php]打印金字塔

<?php
for($line=1;$line<=4;$line++){
    $star = $line*2-1;
    $blank = 5-$line;
    for($blank_content=1;$blank_content<=$blank;$blank_content++){
        echo '&nbsp';
    }
    for($star_content=1;$star_content<=$star;$star_content++){
        echo '*';
    }
    echo '<br/>';
}
?>

posted @ 2015-11-13 00:33  晴明桑  阅读(164)  评论(0编辑  收藏  举报