PHP conditional statement
PHP – if: If the expression is evaluated to true, the condition.
if ($x > $y)
echo "x is bigger than y";
PHP – if else: The PHP’s if else statements are used to perform different actions based on conditions.
Below a variable number is assigned a value 1. ‘if statement’ checks for the value. Since it is evaluated to “1”, it displays the message.
$number = 1;
If ($number ==1)
{
Echo “The number 1”;
} else
{
Echo “not number 1”;
}
Output:
The number 1