What is difference between for and for each loop.

What is difference between for and for each loop.Please explain with a example.

Your Answer

The  foreach loop works only on arrays, and is used to loop through each key/value pair in an array. The main difference is that, you can set the number of iterations in for loop by adjusting counter value. Whereas in foreach loop, the iterations depend on the number of values of the array.

Html

Didn't get the answer.
Contact people of Talent-Html directly by clicking here