复制代码 代码如下:
$arr = array (‘one', ‘two', ‘three', ‘four', ‘stop', ‘five');
while (list (, $val) = each ($arr)) {
if ($val == ‘stop') {
break;
}
echo "$val
/n";
}
$i = 0;
while (++$i) {
switch ($i) {
case 5:
echo "At 5
/n";
break 1;
case 10:
echo "At 10; quitting
/n";
break 2;
default:
break;
}
}
?>
复制代码 代码如下:
<code>
<?php
while (list ($key, $value) = each ($arr)) {
if (!($key % 2)) { // skip odd members
continue;
}
do_something_odd ($value);
}
$i = 0;
while ($i++ < 5) {
echo "Outer<br>/n";
while (1) {
echo " Middle<br>/n";
while (1) {
echo " Inner<br>/n";
continue 3;
}
echo "This never gets output.<br>/n";
}
echo "Neither does this.<br>/n";
}
?></code>
新闻热点
疑难解答