Flow control in PHP : Part 3 – Looping constructs FOR LOOP

The for loop is also similar to the while loop, but with the initialization and increment operations embedded within the loops statement.The initialize expression sets the value of the variable to an initial value. This is executed only during the first iteration. The condition checks the value of the variable during each iteration and the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 2 – Looping constructs DO-WHILE

The do-while loop is similar to the while loop except that the condition is checked after executing the statements instead of at the beginning. The block of code within the loop is executed atleast once. Syntax: do { code to be executed; } while (condition); The default part of the code is executed if the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 1 – Looping constructs WHILE

The while loop repeats the execution of a set of statements as long as a condition is satisfied.The code within the loop is executed until the condition is TRUE. The condition is checked each time before beginning the execution of the code. Each cycle of executing og the code within the loops is called an […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 3 – Conditional statements IF-ELSEIF-ELSE

This statement is used when more than one condition needs to be evaluated. If the condition following if statement is false, the consition following the elseif statement is checked. The else part is executed only if both the conditions are false. Syntax: if (condition) code to be executed if condition is true; elseif (condition) code […]
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 2 – Conditional statements IF-ELSE

The if/else statement is used when a set of statements need to be executed if a condition is true, and another set if the condition is false. Syntax: If (condition) { Code to be executed if condition is true; } else { Code to be executed if condition is false; } Example code:
Continue reading…

Enjoyed this post? Share it!

 
 

Flow control in PHP : Part 1 – Conditional statements

Control structures are used to groups the statements into different blocks. grouping code has advantages while developing and grouping is done for the following reasons: when a block of statements needs to be executed based on the outcome of a condition. Conditional statements – if, if…else, if..elseif..else, and switch are used for this purpose. when […]
Continue reading…

Enjoyed this post? Share it!