Jump to content

Recommended Posts

it will just find 1

try it


<html>
<head>

<title>Sample</title>
</head>

<body>

<?


$char1 = "A";
$char2 = "B";
$char3 = "C";
$char4 = "D";

if ($char1 == "B")
{
print "char 1";
}
else if ($char2 == "B")
{
print "char 2";
} 

else if ($char3 = "C")
{
print "char 3";
}

else { print "none"; }


?>
</body>
</html>

 

Drew

correct me if i am wrong but it will only continue if the statement is false.

 

so:

 

$a = 1;
$b = 4;

if($a == 1){
echo "A is 1<br>";
}elseif($a == 2){
echo "A is 2<br>";
}elseif($b == 4){
echo "B is 4";
}

 

above would only echo A is 1.

i think it would have to be like this

<?
if (BLAH) {
} else if (BLAH) {
else if (BLAH) {
}
else if (BLAH) {
}else if (BLAH) {
}
} else if (BLAH) {
}
?>

you would but a bunch of different else if statements in side of one of the else if state ments

i probly didn't show it very well

but u should get what i mean

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.