Php 创建星形金字塔
这是代码Php 创建星形金字塔,php,web,Php,Web,这是代码 //I want to create a star pyramid..but it not work..can someone assist me to solve it.. 这是输出 致命错误:在第6行的C:\xampp\htdocs\StarPyramid2.php中超过了30秒的最大执行时间 <?php for ($x=1;$x<=5;$x++) { echo "<center>"; for ($y=1;$y=$x;$y++)
//I want to create a star pyramid..but it not work..can someone assist me to solve it..
这是输出
致命错误:在第6行的C:\xampp\htdocs\StarPyramid2.php中超过了30秒的最大执行时间
<?php
for ($x=1;$x<=5;$x++)
{
echo "<center>";
for ($y=1;$y=$x;$y++)
{
echo "*";
}
echo "<br>";
}
?>
$stars=“*”;
回声“;
对于($x=1;$x$y=$x
我想知道这什么时候是错误的?那么如何解决它呢?。给我一些想法。你在第一个循环中做了什么?如果它回答了你的问题,记得把它标记为其他人的答案。
$stars = "*";
echo "<center>";
for ($x=1;$x<=5;$x++)
{
echo $stars;
echo "<br>";
$stars .= "*";
}
echo "</center>";