Sunday, 23 September 2012

PHP control statements

We need to control PHP code based upon different condition for example, if the user click on the registration button, then a registration form will show to the users. To control the PHP code we use different types of PHP control statement such as if, else, for loop, break etc. PHP control statement has been broken into three types of category. 

  1. PHP selection statement
  2. PHP iteration statement
  3. PHP jump statement

From those statements, using PHP selection statement we can easily select different types of PHP code based upon condition. We can divide the PHP selection statement into two parts 
  • PHP if statement 
  • PHP switch statement 
Using PHP iteration statement we can repeat PHP code based upon condition. We can divide PHP iteration statement into three types
  • PHP for loop
  • PHP while loop 
  • PHP do-while loop 
Using PHP jump statement we can break PHP condition and we can jump one code snippet to another code snippet. PHP jump statements are two types
  • PHP break statement 
  • PHP continue statement

No comments:

Post a Comment