How to use if else in php

PHP

We will show you a very simple example how to use if  , else-if and else statements in php.We can check and compare the statements with PHP IF-ELSE statements. With this statement we can block the conditions and some code can be blocked for the condition is not valid.We will show you a simple example how to use the if , else and else if statement in PHP.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IF ELSE Statement Example in PHP</title>
</head>
<body>
<?php
$test = 'Yes';
if($test=='Yes')
{
//If $test has Yes
}
else
{
//If $test does not have Yes
}

$data = 'No';

if($test=='Yes' && $data=='Yes')
{
//if $test and $data both have Yes
}
else if($test=='Yes' && $data=='No')
{
// If $test has Yes and $data has No
}
else
{
//If both conditions got failed
}

?>

</body>
</html>
-->