COMPUTER LEARNING CENTER
WWW.HUUKHANG.COM
<TITLE>::Welcome to PHP</TITLE>
</HEAD>
<BODY>
<h4>IF ELSE Statement</h4>
<?php
$b=true;
$j=3;
if
($j>3)
echo "result is true";
else
{
$j++;
echo "result is $j";
}
?>
</BODY>
</HTML>
4.3.
4.4.
Phaùt bieåu ELSEIF
Phaùt bieåu elseif laø phaàn cuûa phaùt bieåu if else nhieàu nhaùnh, khi coù nhieàu
ñieàu kieän choïn löïa thì baïn söû duïng elseif, cuù phaùp cuûa chuùng nhö sau:
<HTML>
<HEAD>
<TITLE>::Welcome to PHP</TITLE>
</HEAD>
<BODY>
<h4>ELSEIF Statement</h4>
<?php
$b=true;
$j=3;
if
($j>3)
echo "result is true";
elseif
($j=0)
{
$j++;
echo "result is $j";
}
else
{
$j--;
echo "result is ". $j--;
}
?>
</BODY>
</HTML>
Phaùt bieåu Switch (ñieàu kieän)
Phaùt bieåu switch laø phaàn cuûa phaùt bieåu elseif nhieàu nhaùnh, khi coù nhieàu
ñieàu kieän choïn löïa thì baïn söû duïng switch, cuù phaùp cuûa chuùng nhö sau:
3-8