Jump to content

multiple condidtions in an if statement


CircularStopSign

Recommended Posts

Use:
[code=php:0]if($var == $array[0] || $var == $array[1] || $var == $array[2])
{
    echo "Stuff is equal too 0,1, and 2";
}[/code]


How ever what you'll probably want to use is in_array:
[code=php:0]if(in_array($var, $array)
{
    echo ;    echo "$var us in the array!";
}[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.