[PHP] if (this but not that)

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

[PHP] if (this but not that)

Postby leke » Thu Apr 14, 2011 4:26 pm

I'm having some kind of mental block (blames PHP) and can't think how to test true for something and false for something else.

maybe like:
if (value1 == true && value2 == false) {run code;}

...or am I going about it the wrong way?
User avatar
leke
LXF regular
 
Posts: 503
Joined: Mon Oct 22, 2007 5:45 pm
Location: Oulu, Finland

Postby bobthebob1234 » Thu Apr 14, 2011 4:57 pm

if(value1 && !value2) {

}

??
For certain you have to be lost to find the places that can't be found. Elseways, everyone would know where it was
User avatar
bobthebob1234
LXF regular
 
Posts: 1369
Joined: Thu Jan 03, 2008 9:38 pm
Location: A hole in a field

Postby leke » Thu Apr 14, 2011 6:03 pm

Thanks Bob, and now that my brain is working again, I realised I should have searched the manual for boolean -- but that didn't occur to me at the time :oops:
User avatar
leke
LXF regular
 
Posts: 503
Joined: Mon Oct 22, 2007 5:45 pm
Location: Oulu, Finland

Postby bobthebob1234 » Thu Apr 14, 2011 7:39 pm

Happens to the best of us :D
For certain you have to be lost to find the places that can't be found. Elseways, everyone would know where it was
User avatar
bobthebob1234
LXF regular
 
Posts: 1369
Joined: Thu Jan 03, 2008 9:38 pm
Location: A hole in a field


Return to Programming

Who is online

Users browsing this forum: No registered users and 0 guests