Maybe you can try simplifying your logic.

Why don't you avoid nested IFs till later, and keep to simple IFs.
If you want to check for $site_style not equal to 10 and also not equal to 9
then you can say 

($site_style != 10 &&  $site_style != 9)

or even 

!($site_style == 10 ||  $site_style == 9)

then later if you want to check for $site_style == 10 
make a separate IF rather than use a elsif, just for ease of comprehension.

-Naintara



----- Original Message ----- 
From: "Jason Dulberg" <[EMAIL PROTECTED]>
To: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, October 04, 2001 11:12 AM
Subject: RE: [PHP] php in css not working with IF's


Thanks for sticking with me here and for your examples!!

So basically, I need to use AND instead of OR.

if (($site_style!=="10") && ($site_style!=="9") && ($site_style!=="8")) {
}

elseif ($site_style=="10") {
}

hrm... it didn't work.

Sorry for being such a dope about this.... :(

Jason



> Ok, you are clearly not following along here...  ;)
> 
> You have (let $site_style = A for brevity):
> 
> if( A!=10 OR A!=9 OR A!=8 )
> 
> When A=10 this becomes:
> 
> if( 10!=10 OR 10!=9 OR 10!=8 )
>      false    true     true
> 
> if( false OR true OR true ) is the same as if (true)
> 
> Seriously, try drawing the Venn diagram for your expression.
> 
> Or try substituting common english.
> 
> if Jason is not 21 or Jason is not 20 or Jason is no 19 let him into the
> cool club.
> 
> Say Jason is 21, is he allowed in?  Sure he is, because one of the
> conditions for getting into the cool club is that Jason is not 20.  It
> doesn't matter that one of the other conditions says to not let Jason in.
> If the people writing the rules wanted to force all the conditions to
> apply they would have written:
> 
> if Jason is not 21 AND Jason is not 20 AND Jason is not 19, let him into
> the cool club.
> 
> -Rasmus
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to