Home > php教程 > php手册 > body text

深入理解php中的while循环

WBOY
Release: 2018-10-26 17:43:15
forward
985 people have browsed it


这篇文章主要介绍了php中的while循环,有一定的参考价值,感兴趣的朋友可以参考一下,希望对你有所帮助!

1 while(condition)2 {3   func();4   //break the loop5   6 }
while循环的执行顺序是先判断condition是不是true,如果是true,那么就执行while循环体的代码,这是一个回合,
然后再次判断condition是否为true。。。。进入下个回合。
Copy after login

那么什么时候退出循环呢?通常在while循环体里面有自增或者自减代码,它们的就是为了跳出循环而存在的,当然还有一些其它的语句强制跳出循环,比如break。

需要注意的点:while循环每次执行都会判断condition是否为true。

【相关教程推荐】

1. php编程从入门到精通全套视频教程 

2. php从入门到精通  

3. bootstrap教程 

Related labels:
source:cnblogs.com
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!