ForeachPhp Tutorial 4 (not php 3) includes the foreach structure, which is similar to perl and other languages. This is just a simple way to traverse arrays. Foreach can only be used for arrays. An error occurs when you try to use it for another
You can use the for statement to control multiple variables to implement advanced applications with multiple loops.The following shows a program that uses the for statement to output a 9*9 multiplication table: The code is as follows:Copy code
A while loop in PHP that iterates through the number of code block attempts, or loops through code blocks when the specified condition is true.
-------------------------------------------------------------
When we write code, we often need a block
In front of you to explain the PHP loop statement in the while statement loop, in fact, while the statement has another form of expression, which is what we are going to explain to you today,
"Do...while" loop statement。
Do...while The concept of
In our program development, it may be necessary to repeat the use of a piece of code or a function, such as the need to enter "1*2*3*4...*100", if the human input, it will waste a lot of time, but also very cumbersome, but in this case, there is a
PHP Loop-While Loop
Loop executes the number of times specified by the code block, or the loop executes the code block when the specified condition is true.
PHP LoopsWhen you write code, you often need to have the same code block run
PHP loop statement details: while, for, foreach, dowhile. PHP loop statement explanation while, for, foreach, dowhile 1, while loop while (expression) {loop body; repeated execution until the expression is false} code: $ index1; while ($ index5)
In the picture, why is the ending Mark written in the curly braces at the beginning of the while loop? the ending curly braces at the end of the while loop are separately included by the php tag. why is the independent php tag in the while execution
While loopWhile loop is the simplest loop in PHP. Its basic format is: The code is as follows:Copy code While (expr ){Statement}// OrWhile (expr ):StatementEndwhile; This syntax indicates that as long as the expr expression is TRUE, statement
Deep understanding and analysis of PHP loop statements -- while, for, foreach, do while, whileforeach
Loop Structure 1. while LoopWhile (expression){Loop body; // execute repeatedly until the expression is false}Code:$ Index = 1;While ($ index
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.