Home > php教程 > php手册 > PHP输出一个等腰三角形的方法

PHP输出一个等腰三角形的方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 09:04:15
Original
2388 people have browsed it

PHP输出一个等腰三角形的方法

   本文实例讲述了PHP输出一个等腰三角形的方法。分享给大家供大家参考。具体实现方法如下:

  ?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

function isosceles($line,$sing){

$tab ='=';

for($i=1;$i

$blank = print_blank($i,$line,$tab);

$code = print_code($i,$sing);

echo $blank.$code.$blank."
";

}

}

function print_blank($num,$line,$tab){

$blank ='';

for($i=$num;$i

$blank.=$tab;

}

return $blank;

}

function print_code($num,$sing){

$code ='';

for($i=0;$i

$code.=$sing;

}

return $code;

}

$line = 5;

$sing = "*";

isosceles($line,$sing);

  运行结果如下:

  ====*====

  ===***===

  ==*****==

  =*******=

  *********

  希望本文所述对大家的php程序设计有所帮助。

Related labels:
source:php.cn
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template