Jump to content


Photo

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


  • Please log in to reply
2 replies to this topic

#1 neddy

neddy
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 12 June 2006 - 01:38 PM

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

if($var = 1) {
print $var." = 1";
}else{
print $var." doesnt = 1"
}

i need to change it to

if($var = 1 or 2 or 3) {
....

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

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 12 June 2006 - 01:41 PM

if (1 <= $var <= 3) ?
z..z..z..z..z..z..z..z..

#3 neddy

neddy
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 12 June 2006 - 01:54 PM

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

if($var == 1 || $var == 2 || $var == 3) {

seems to be working

thanks anyway :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users