HOME
PHP
Introduction Php Installation
PHP Basic Scripts
PHP variables
PHP operators
PHP Conditional statement
PHP functions
PHP Arrays
PHP Objects & classes
PHP with Forms
PHP Files
PHP With Database
PHP session
PHP cookies
PHP Regular Expressions
PHP Server Environment
PHP Graphics
PHP Advance
|
PHP CONDITIONAL STATEMENT
most scripts evalute conditions and change their behaviur accordingly.the facility to make desisions makes your PHP pages dynamic ,capable of changing
their output according to circumstances.like most programming language PHP allows you to do this with an if statement.
IF statement
-
if...else statement - use this statement if you want to execute a set of code when a condition is true and another if the condition is not true
-
elseif statement - is used with the if...else statement to execute a set of code if one of several condition are true
example 1
if (expression)
{
//code to execute if the expression evaluates to true
}
example 2
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
|
IF example
| |