*********************php实现打印金字塔*********************
$n=20;
for($i=1;$i<=$n;$i++){
for($k=1;$k<=$n-$i;$k++){
echo " ";
}
for($j=1;$j<=($i-1)*2+1;$j++){
echo '*';
}
echo '<br />';
}
?>
*************************************************************
***********************php实现平均数*************************
<head>
<meta http-equiv="conter-type" content="text/html;charset=utf-8">
</head>
<body>
<h1>输入成绩,用空格隔开</h1>
<?php
//接受用户提交的成绩!
$grades1=@$_REQUEST['grade'];
//echo 'grade='.$grades;
//拆分,对成绩进行分割
$grades=explode(" ",$grades1);
//遍历
$allGrades=0;
foreach($grades as $K=>$V){
$allgrades+=$V; //隐藏转换 string->float
}
?>
<form action="Array01.php" method="post">
<input type="text" name="grade" value="<?php echo $grades1;?>"/>
<input type="submit" value="开始统计"/>
</form>
<?php
echo "平均时间是=".$allgrades/count($grades);
?>
</html>
***************************************************************