Forum Moderators: coopster

Message Too Old, No Replies

Using more than one condition within an IF statement

         

mack

5:26 am on Oct 18, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Im having some problems gettign the tyntax working correctly in the following.

if ($name == "Google"¦¦"Yahoo"¦¦"Live search")
{
$name="Search engine";
}
If ($name == "Coke"¦¦"Pepsi")
{
$name="Drink company";
}

echo "$name";

What I am tryign to do is.. If any are true, set the value of $name. Im not sure what syntax I should be using.

Thanks in advance.

Mack.

Anyango

7:23 am on Oct 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if ($name == "Google" ¦¦ $name=="Yahoo" ¦¦ $name=="Live search")
{
$name="Search engine";
}
If ($name == "Coke" ¦¦ $name=="Pepsi")
{
$name="Drink company";
}
echo "$name";

mack

6:00 pm on Oct 18, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Anyango thank you very much. Worked as planned.

Thanks again.

Mack.

Receptional Andy

7:04 pm on Oct 18, 2008 (gmt 0)



Just as an aside, your original syntax is closer to how it might work with regex matching:


if (preg_match("/google¦yahoo¦msn/",$name)) {
$name="Search engine";
}