How to terminate the Loop statement in PHP
This article mainly introduces "how to terminate the loop sentence in PHP". In the daily operation, I believe that many people have doubts about how to terminate the loop sentence in PHP. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubt of "how to terminate the loop sentence in PHP". Next, please follow the editor to study!
Description
1. An array is defined and the array values are iterated through the foreach statement.
2, judged by if, if $month is equal to stop, then break the loop through break, will directly output all the array elements before stop, then the elements after stop will not be output naturally.
Example