<?php
/*时间:2014-09-15
*作者:葛崇
*功能:9*9乘法表小实例
* */
/*
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
*/
echo "第一种";
echo "<table border=2>";
for($i=1;$i<=9;$i++){
echo "<tr>";
for($j=1;$j<=$i;$j++){
echo "<td>"."$j*$i"."="."$i"*"$j"."</td>";
}
echo "</tr>";
echo "<br/>";
}
echo "</table>";
echo "第二种";
echo "<table border=2 >";
for($i=9;$i>=1;$i--){
echo "<tr>";
for($j=1;$j<=$i;$j++){
echo "<td>"."$j*$i"."="."$i"*"$j"."</td>";
}
echo "</tr>";
echo "<br/>";
}
echo "</table>";
echo "第三种";
echo "<table border=2 >";
for($i=9;$i>=1;$i--){
echo "<tr>";
for($k=0;$k<9-$i;$k++){
echo "<td> </td>";
}
for($j=1;$j<=$i;$j++){
echo "<td>"."$i*$j"."="."$i"*"$j"."</td>";
}
echo "</tr>";
echo "<br/>";
}
echo "</table>";
echo "第四种";
echo "<table border=2 >";
for($i=9;$i>=1;$i--){
echo "<tr>";
for($k=1;$k<$i;$k++){
echo "<td> </td>";
}
$i1=10-$i;
for($j=1;$j<=10-$i;$j++){
//$j1 = 10-$j;
echo "<td>"."$j*$i1"."="."$i1"*"$j"."</td>";
}
echo "</tr>";
echo "<br/>";
}
echo "</table>";
?>