<?php
function Leijia ($number) {
$arr =[];
for ($i =1; $i <= $number; $i + +)
{
for ($j =1; $j <= $number; $j + +)
{
$j ==1 is to let I cycle from 1 to 10 end
if ($j ==1) {
$arr [$i][]= $i;
Continue
}
$i ==1 is to let J's loop start from 1 to 10 end
if ($i ==1) {
$arr [$i][]= $j;
Continue
}
Var_dump ($arr [$i]);
The value of 2nd to nth of layer 2nd to Nth is the sum of the previous number of this layer and the number of the same column in the previous layer
$arr [$i][]= $arr [$i][count ($arr [$i]) -1]+ $arr [$i -1][count ($arr [$i])];
}
}
Output in PHP tabular format
echo "<table border=1>";
foreach ($arr as $key = $val)
{
echo "<tr>";
foreach ($val as $k = $v)
{
echo "<td>";
Echo $v;
echo "</td>";
}
echo "</tr>";
}
echo "</table>";
}
Incoming numbers are the number of layers to accumulate
Leijia (10);
?>
The next step is to update the usage of the October CMS, or go to the code cloud to see what I have written on the Laravel framework URL: Https://gitee.com/lfm123456/zhiye
php--Common Algorithm 3