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
if condition statement delimma
Moderator: General Moderators
Code: Select all
if($action == ('register' ||'renew'||'transfer')){you must do
Code: Select all
if($action == 'register' || $action=='renew' || $action=='transfer')){Code: Select all
if ( ( $action == 'register' ) || ( $action == 'renew' ) || ( $action == 'transfer' ) ) {Yea they both work good.
the php manual has some good info on the if() statement, and also it's many related functions.
the php manual has some good info on the if() statement, and also it's many related functions.