Conditional Operator in PHP

Notes:

PHP Conditional Operator

Conditional Operator ( ? : ): is the only ternary operator; which accepts 3 operands.
(operand1) ? operand2 : operand3;
Where:
operand1: should be a condition
operand2: value1
operand3: value2

Ex:
$num=10;
$result = (($num%2)==0) ? "even" : "odd";
echo $num," is ", $result, " number";

Note: Conditional operator is kind of short hand notation for if else statement in PHP.

Ex:
$num=10;
$result="";
if(($num%2)==0)
{
$result="even";
}
else
{
$result = "odd";
}
echo $num," is ", $result, " number";

Interview Questions:

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