Php program to execute the if-else if condition

A Php program to execute the if-else if condition. Using this simple PHP program we can print the if-else condition in PHP. The conditional statements in PHP are as follows: If a condition is true, the if statement executes some code. If a condition is true, the if-else statement executes some code; if the condition is false, it executes another code. If more than two conditions are met, the else if and else statements are used to execute different programs.

<?php
$t = date("H");
if ($t < "1")
{
echo "You can learn programming";
}
elseif ($t < "2")
{
echo "Good for php";
}
else {
echo "Welcome to php";
}
?>

 

Output:

Welcome to php