a"; }else { echo "
"; } } } ?> PHP prints Yang Hui's triangle custom copy code. The code is as follows:&l"/>
a"; }else { echo "
"; } } } ?> PHP prints Yang Hui's triangle custom copy code. The code is as follows:&l">
Home >Backend Development >PHP Tutorial >Yang Hui Triangle PHP Write Yang Hui Triangle Example Code
Copy code The code is as follows:
//Yang Hui triangle
for ($i=6;$i >= 0;$i--)
{
for ($j= $i;$j <= 6;$j++)
{
if ($j <= 6-1)
{
echo "a";
}else
{
echo "
";
}
}
}
?> action="">
Input the order of Yang Hui's triangle:
"; echo $yh[ $i][$j]; echo " | ";