PHP if else statement

If else statement in PHP

php-if-else-statement.jpg
Php if-else statement

  • The if-else statement in Php is executed if the condition is true or false.
  • If- else statement-executes any code if the condition is correct and if the condition is incorrect
  • If-else statement differs slightly from if statement. If the specified condition is true it executes one block of code, and another block of code if the condition is false.

Syntax of the if-else statement in PHP:

if (condition) {
    code to be affected if condition is true;
} else {
    code to be affected if the condition is not true;
}
This PHP if-else statement returns TRUE when the code is to be executed or FALSE on failure

flow chart of the if-else statement:


Read more...

Also, visit here - Codeigniter Tutorial


Comments

Popular posts from this blog

Laravel Tutorial for Beginners

Ajax Tutorial

CodeIgniter Tutorial