php如何输出菱形

发布日期:2025-12-02 00:22:02 阅读:1

php$rows = 5; // 中间行数// 输出上半部分菱形for ($i = $rows - 1; $i >= 1; $i--) { $spaces = str_repeat(' ', $i - 1); $stars = str_repeat('*', 2 * ($rows - $i) + 1); echo $spaces . $stars . "n";}// 输出中间行$midLine...

评论列表
暂无评论,来说两句吧~
相关推荐