you can look at
Haim Evgi
2010-09-20 15:09:55
An if/else statement is used to check a single condition. An if/elseif/else statement is useful when you have several conditions, but you can also solve that problem with a switch, like this:
<?php
if ($i == 0)
{
echo 'i equals 0';
}
elseif ($i == 1)
{
echo 'i equals 1';
}
elseif ($i == 2)
{
echo 'i equals 2';
}
switch ($i)
{
case 0:
echo 'i equals 0';
break;
case 1:
echo 'i equals 1';
break;
case 2:
echo 'i equals 2';
break;
}
?>
Which one you want to use is up to you.