PHP - While Loop

PHP While loop do over and over tasks as long as the specified condition is true.

Syntax:
while (condition){
    // to do
}

PHP - Switch Statement

Switch statement uses to perform different actions based on the different conditions of same variable at once. It takes one variable as an input and then check different conditions setup for switch statement. It acts like a set of if statements define for a variable.

Syntax:
switch (<variable>){
    case <label 1>:
        {code to be executed if the variable is label 1};
        break;
    case <label 2>:
        {code to be executed if the variable is label 2};
        break;
   default:
        {code to be executed if the variable is not equal to above labels};
        break;
}