这篇文章主要介绍了php中的while循环,有一定的参考价值,感兴趣的朋友可以参考一下,希望对你有所帮助!
1 while(condition)2 {3 func();4 //break the loop5 6 } while循环的执行顺序是先判断condition是不是true,如果是true,那么就执行while循环体的代码,这是一个回合, 然后再次判断condition是否为true。。。。进入下个回合。
那么什么时候退出循环呢?通常在while循环体里面有自增或者自减代码,它们的就是为了跳出循环而存在的,当然还有一些其它的语句强制跳出循环,比如break。
需要注意的点:while循环每次执行都会判断condition是否为true。
【相关教程推荐】
2. php从入门到精通
3. bootstrap教程

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
