Skip to Content
Core PHP Programming, Third Edition
book

Core PHP Programming, Third Edition

by Leon Atkinson
August 2003
Intermediate to advanced
1104 pages
19h 27m
English
Pearson
Content preview from Core PHP Programming, Third Edition

3.4. Loops

Loops allow you to repeat lines of code based on some condition. You might want to read lines from a file until the end is reached. You might want to print a section of HTML code exactly ten times. You may even wish to attempt to connect to a database three times before giving up. You may want to read data from a file until there's no more data to read. You can do all of these things with loops.

Each execution of the code inside a loop is an iteration. Loops iterate on the code until a stop condition is met. PHP supports four types of loops that vary from each other in what they iterate on, the actions taken before the loop begins, and whether the stop condition is checked at the beginning of each iteration or at its end.

The while ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming PHP, 3rd Edition

Programming PHP, 3rd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Programming PHP

Programming PHP

Rasmus Lerdorf, Kevin Tatroe
Programming PHP, 2nd Edition

Programming PHP, 2nd Edition

Rasmus Lerdorf, Kevin Tatroe, Peter MacIntyre
Advanced PHP Programming

Advanced PHP Programming

George Schlossnagle

Publisher Resources

ISBN: 0130463469Purchase book