Shoutbox

AND and OR - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: AND and OR (/showthread.php?tid=21575)

AND and OR by leito on 02-19-2004 at 04:47 AM

Hi, again! hahaha, I want to make something like this in PHP

if ( $a=yes OR ($b<=10 AND $c<=10) { etc.

Were, <= means "smaller or equal to"
and one condition is $a=yes
and the other conditions is $b<=10 AND $c<=10

I think this could be like...

if ($a=="yes" || ($b<="10" && $c<=10)) {

My question is can i group conditions using ()? Is <= the way you write "smaller or equal to"?

Thank you in advance for your help.


RE: AND and OR by WDZ on 02-19-2004 at 05:05 AM

quote:
Originally posted by leito.gt
My question is can i group conditions using ()?
Yes. The example you posted should work fine, though I'd remove the quotes around "10" as it's an integer, not a string.

quote:
Is <= the way you write "smaller or equal to"?
Yes. Technically it's called "less than or equal to." :p
RE: AND and OR by fluffy_lobster on 02-19-2004 at 07:44 PM

Just in case you didn't know, by the way, if you want it to execute only of one of the two are true and not both, use XOR.


RE: AND and OR by leito on 02-19-2004 at 09:18 PM

fluffy what does XOR means? what I want is that if one condition is true, "good to go" haha.

And WDZ thanks, for the "less than or equal to" hahaha, I learn something new!


RE: AND and OR by Apatik on 02-19-2004 at 10:16 PM

XOR is false if the two conditions are verified, true when one and only one of the two conditions is verified


RE: AND and OR by Choli on 02-19-2004 at 10:23 PM

XOR: eXclusive OR: A XOR B: or A or B but not both at the same time ;)


RE: AND and OR by user2319 on 02-20-2004 at 05:04 PM

he wants one of them to be true ;)

quote:
what I want is that if one condition is true, "good to go" haha.

RE: AND and OR by WDZ on 02-20-2004 at 05:20 PM

quote:
Originally posted by PlusFan
he wants one of them to be true
He didn't say "only one" though, and if two are true, that means one is true. :refuck: