Page 1 of 1

if condition statement delimma

Posted: Fri Apr 25, 2003 9:59 am
by kendall
Hello,

i am having a difficult time understanding an if statement that i am trying to understand

i have coded an iff statement -

if($action == ('register' ||'renew'||'transfer')){

do the thing
}elseif($action == 'hosting'){
do the damn thing
}

now on $action = register

it - 'do the thing'

but on $action = hosting

it - 'do the thing' when it should 'do the damn thing'

what is wrong with my syntax?

Kendall

Posted: Fri Apr 25, 2003 10:15 am
by d1223m

Code: Select all

if($action == ('register' ||'renew'||'transfer')){
this is illegal
you must do

Code: Select all

if($action == 'register' || $action=='renew' || $action=='transfer')){

Posted: Fri Apr 25, 2003 10:19 am
by Wayne

Code: Select all

if ( ( $action == 'register' ) || ( $action == 'renew' ) || ( $action == 'transfer' ) ) {

Posted: Fri Apr 25, 2003 12:50 pm
by m3mn0n
Yea they both work good.

the php manual has some good info on the if() statement, and also it's many related functions.