Jump to content

Archived

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

neddy

if($var=='1'or'2'or'3)?

Recommended Posts

hey

ive been using php for a while now but never needed this before (or even know if its possible)

so heres what i have..

[code]
if($var = 1) {
print $var." = 1";
}else{
print $var." doesnt = 1"
}
[/code]

i need to change it to

[code]
if($var = 1 or 2 or 3) {
....
[/code]

how do i go about doing that? i tried a few ways but couldnt figure it out, and couldnt find anything more complex then what i already have on any online tutorials...

cheers

Share this post


Link to post
Share on other sites
doh

as soon as i posted i found the answer

my 1,2,3 are gonna be different numbers soi need or

anyway i did

[code]if($var == 1 || $var == 2 || $var == 3) {[/code]

seems to be working

thanks anyway :)

Share this post


Link to post
Share on other sites

×

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.