Re: php in css not working with IF's

From: Date: Thu, 04 Oct 2001 06:28:13 +0000
Subject: Re: php in css not working with IF's
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69895@lists.php.net to get a copy of this message
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" <jdulberg@nas.net> To: "Rasmus Lerdorf" <rasmus@php.net> Cc: <php-general@lists.php.net> 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: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#69895) next »