Conditional statements are used to perform different actions based on different conditions.
PHP contains following conditional statements
Simple if statement contains only one response if condition is true.
<?php
$day=strtoupper(date("D"));
if($day=="FRI")
echo "Have a Nice Weekend!";
?>
if else statement contains response for both true & false conditions
<?php
$day=strtoupper(date("D"));
if($day=="FRI")
echo "Have a Nice Weekend!";
else
echo "Have a Nice Day!";
?>
IF...ELSE-IF...ELSE is used in multiple conditions scenario.
<?php
$day=strtoupper(date("D"));
if($day=="FRI")
echo "Have a Nice Weekend!";
else if($day=="SUN")
echo "Have a Nice Sunday!";
else
echo "Have a Nice Day!";
?>