Session is a way to store information so that user data can be retrieved on multiple pages of the application. Session data is stored on user basis so that the data is available only for the same user.
The main difference between a while and do-while loop is that in a do-while loop, the statements in the loop will be executed at least once.
A while loop is used to repeatedly execute a set of statements as long as the condition remains true.
Unlike a for loop, the PHP foreach loop works only with arrays and objects. The foreach loop starts with the first element of the array and during each iteration, the next array element is fetched.
A for loop is used to execute the program for a fixed number of times. For loop in PHP is similar to that in C, C++ or Java.