Learning conditional statements in PHP

Conditionals allow your program to make choices. Following the same sort of boolean logic you just learned about, the computer can only make two choices; true or false. In the case of PHP this is accomplished using IF : ELSE statements. Below is an example of an IF statement that would apply a senior’s discount.

in following statements if $name is premal then all statements inside breckets should be display.

<?php

$name=”premal”;

if($name=”premal”)

{

echo “Premal Katigar”;

}

else

{

echo “Wrong Statement”;

}

?>

Advertisements