PHP -Building Blocks

PHP -Building Blocks

If –else statements
if…else statement – executes set of codes if a condition is true and another code if the condition is false
Within a statement, if a certain condition is true, then something happens. Otherwise, something else happens. We can continue adding else statements as many times as we need.
So, within PHP statement, we first define the variable and then set up the conditional statements like this:web designing institutes, web development course, php course in gurgaon

web development training institutes in gurgaon

Syntax
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;

web designing institutes in gurgaon
Example

{
echo “You have a good score”;
}
else
{
echo “Score is less than average”;
}
?>

Example 2:
$status = 1;
if ($status== 1)
{
print (““);
}
else
{
print (““);
}
?>

php training institutes in gurgaon

The variable called $status has been assigned a value of 1.The first line of if statement tests to see what is inside of the variable called $status. It’s testing to see whether this variable has a value of 1.

Days in current month

Enjoy the tutorial? Please spread the word :)

Follow by Email
Facebook
Facebook
Google+2k
Google+
http://hirdeshbhardwaj.com/2017/11/01/php-building-blocks-2
YouTube44
YouTube