天天看點

PHP中continue語句的應用

涓? 瀹?渚?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>浣跨??ontinue?抽??瀛??у?舵?绋?</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
}
body {
	margin-left: 10px;
	margin-top: 10px;
	margin-right: 10px;
	margin-bottom: 10px;
	background-color: #CCFF33;
}
-->
</style></head>
<body>
<?php
	$arr = array("PHP绋?搴?寮?????渚?瀹???,"PHP寮????稿??妯″??澶у??,"PHP?芥?闆????澶у??,"PHP椤圭??寮????ㄧ?瀹?褰?","PHP浠??ラ?ㄥ?扮簿??","PHP缃?缁?缂?绋???瀛?????");	//澹版??涓?涓??扮?????$arr
	for($i = 0; $i < 6; $i++){					//浣跨??or寰???
		echo "<br>";
		if($i % 2 == 0){						//濡???$i???間負?舵?幫???璺沖?烘??娆″驚??
			continue;
		}
		for(;;){										//????寰???
			for($j = 0; $j < count($arr); $j++){		//??娆′嬌??or寰???杈??烘?扮?????
				if($j == $i){							//濡???褰???杈??虹???扮?涓???绛?浜?$i
					continue 3;							//璺沖?烘??澶???寰???
				}else{
					echo $arr[$j]."\t | ";				//杈??鴻〃杈懼?
				}
			}
		}
		echo "浣?姘歌??界??涓??版????";
	}
?>
</body>
</html>
           

?

浜? 杩?琛?缁???

PHP中continue語句的應用

? 涓? 浠g?????? for瀹???娆″驚??锛??朵腑澶???绗?1,3,5娆″驚??锛???瀵圭??1娆″驚??锛?杈??轟?涓?瀛?绗?覆锛???瀵圭??3娆″驚??锛?杈???涓?瀛?绗?覆锛???瀵圭??5娆″驚??锛?杈???涓?瀛?绗?覆??娉ㄦ??浣?浼?continue 3????涔?锛?璺沖?扮??涓?灞?寰?????