Home >Backend Development >PHP Tutorial >Example of using break to jump out of multiple loop codes in PHP, phpbreak_PHP tutorial

Example of using break to jump out of multiple loop codes in PHP, phpbreak_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:09:27783browse

Examples of using break to jump out of multiple loop codes in PHP, phpbreak

Copy code The code is as follows:

$array = array(1,2,3,4,5,6);
for($i=0;$i<10;$i++){
foreach($array as $key)
{
echo $key;
if($key==2){

Break 2;
}
}
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/945710.htmlTechArticleUse break to jump out of multiple loop code examples in PHP. The phpbreak copy code is as follows: $array = array(1,2 ,3,4,5,6); for($i=0;$i10;$i++){ foreach($array as $key) { echo $key; if($key...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn