What is the function of for in php
This article mainly explains "what is the role of for in php". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the role of for in php"?
For in php refers to a PHP for loop statement that iterates through the number of times specified in a block of code, using syntax such as "for (init counter; test counter; increment counter) {...}".
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
What does for mean in php?
The number of times the PHP for loop executes the code block specified.
If you have determined in advance how many times the script will be run, you can use the for loop.
Grammar
For (init counter; test counter; increment counter) {code to be executed;}
Parameters:
Init counter: initializes the value of the loop counter
Test counter:: evaluates each iteration of the loop. If the value is TRUE, continue the loop. If its value is FALSE, the loop ends.
Increment counter: increase the value of the loop counter
The following example shows a number from 0 to 10:
Example
Thank you for your reading, the above is the content of "what is the role of for in php". After the study of this article, I believe you have a deeper understanding of the role of for in php, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!