for ($i = 0; $i <= 2; $i + +) { $i;} echo $i;
So why not get the value of getting the loop out of this to get the last one modified into this
for ($i = 0; $i <= 2; $i + +) {
So that you can get all the values, but some of the statements do not want to put in the loop statement, what is the way to get the value in the loop statement?
Reply to discussion (solution)
In a looping statement, a variable (array or character) is used to hold the value of each loop, which is called outside the loop.
Did not save, of course, every time to get the last one.
Landlord This is the logic of your need to have a problem
The statement is placed outside the loop, which is fine, but how does a statement outside the loop use the value of a particular loop within a loop? How do you decide which one to use?
Landlord This is the logic of your need to have a problem
The statement is placed outside the loop, which is fine, but how does a statement outside the loop use the value of a particular loop within a loop? How do you decide which one to use?
I think there's a problem with logic, actually, I want to get the value of the inner edge of the loop statement outside of the loop statement, but there's no idea or code to write.
In a looping statement, a variable (array or character) is used to hold the value of each loop, which is called outside the loop.
This method is feasible but the specific code to write the master write code to let the novice reference
for ($i = 0; $i <= 2; $i + +) { $t [] = $i;} echo Join (', ', $t);
Landlord This is the logic of your need to have a problem
The statement is placed outside the loop, which is fine, but how does a statement outside the loop use the value of a particular loop within a loop? How do you decide which one to use?
I think there's a problem with logic, actually, I want to get the value of the inner edge of the loop statement outside of the loop statement, but there's no idea or code to write.
Then you first think about logic and process, programming is actually to translate logic into code ... We can help you sort out the logic.