El contenido de la matriz correspondiente a la representación de la lista.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php $arr = array("足球","篮球","跳水","保龄球","冰球","橄榄球","高尔夫球","乒乓球","羽毛球","排球") ?>
<ul>
<?php for($i=0; $i< count($arr); $i++){ ?>
<?php
echo "<li>$arr[$i]</li>"
?>
//等价于
<li>
<?php echo $arr[$i] ?>
</li>
<?php }?>
</ul>
</body>
</html>
Decoloración de las filas entrelazadas de la mesa.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
table,tr,td{
border:1px solid #333;
border-collapse:collapse;
}
td{
width:60px;
height:20px;
}
.skyblue{
background:skyblue;
}
</style>
<body>
<table>
<?php for($i=0; $i<20; $i++){ ?>
<tr <?php if($i % 2 == 0){ echo "class='skyblue'";} ?> >
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php } ?>
</table>
</body>
</html>