CodesJava

Easy learning with example program codes

PHP Control Statement


All the conditional statements and loop statements are collectively termed as Control Statements.

Conditional Statements:

Conditional statements are used in a code to perform an action only if a particular condition is satisfied.

PHP provides four types of conditional statements. These are:

if:

If statement is used to perform an action if a single condition is true.

..else:

If else statement is used to perform an action if a single condition is true and to perform another action if that condition is false.

..elseif….else:

If elseif else statement is used to perform different actions for different conditions.

switch:

Switch statement is used to select one of the action to perform from multiple actions, relative to the true condition.

Loop Statements:

Loop Statements are used to execute a block of code continuously as long as the condition of the loop is true, and stops only when the condition fails.

PHP provides three types of loop statements. These are:

For loop:

For loop is used to execute a group of action only for a specified number of times.

While Loop:

While loop is used to execute a group of action as long as the specified condition is true.

Do While Loop:

Do While loop is used to execute a block of code at least once and then to repeat the actions as long as the specified condition is true.

Posted in PHP   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki