[embedyt] https://www.youtube.com/watch?v=-mzXV5J3Jjg[/embedyt]
Loops in programming Languages are generally used to fulfill the exact or similar block of sequence repeatedly until the condition that initiates it terminates. The major idea is to introduce concision to algorithmic tasks; rather than an elaborate process that consumes time and resources.
Now, PHP houses iterative loops such as for, while, do while, for-each, continue and others.
While | Permits execution while a given condition remains true and terminates once its false |
For | Executes routine program instruction until an index/range limit is reached |
For each | Majorly used in traversing an array |
Continue | Takes out a member of an array and “continues” algorithmic process for the rest. |
Do while | Performs (doing) a specific task while a certain condition remains true. |
Break | Commonly used for pausing a computer program execution |
Case structures | Specifically carries out execution based on a certain declared variable |
In approximately forty (40) minutes, this video lays a firm foundation on practically using php loops in engineering web applications.