if else Statement in PHP

Notes:

PHP Conditional Statements:
Conditional / selection statements:
- help us to execute set of statements based on the result of a given conditional expression
if,
if else,
else if ladder,
switch case

if else statement:
- executes true part; if the conditional expression inside the parenthesis evaluates to true, else it executes the false part.

syntax:
if(conditional expression)
{
statements; // true part
}
else
{
statements; // false part
}

OR

if(conditional expression):
statements; // true part
else:
statements; // false part
endif;

Note: if the true part gets executed then the false part is not executed, vice versa.

Example code:
$a=10;
if($a==10)
{
echo "a is equal to 10";
}
else
{
echo "a is not equal to 10";
}

OR

$a=20;
if($a==10):
echo "a is equal to 10";
else:
echo "a is not equal to 10";
endif;

Interview Questions:

1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a