Solo
Solo

Reputation: 6957

When does PHP continue from loops?

My question is about foreach and for loop: does it continue reading code if it has finished whole loop, after first "round" or is there any other options?

I honestly didn't find any answers online - I tried at least 10 ways of phrasing. I might just suck at english.

Upvotes: 0

Views: 22

Answers (1)

Ikechukwu Kalu
Ikechukwu Kalu

Reputation: 1644

A foreach loop iterates through the elements of an array and performs the operations in its block of code. A for loop repeates the operations in its block of code until it is done or a particular condition is met before it breaks out using break. Both loops must finish their operations in its block before continuing with any other code unless a condition is met. Let me know if more clarification is needed

Upvotes: 1

Related Questions