Jump to content

If Statement Problem


richie19rich77

Recommended Posts

Hi Everyone

I can run all these statements one after another and they work fine, but when I put them together I get strage results.

lets just say that itemvalue = 11 and partnervalue = 11

if ((itemvalue-partnervalue>=2)||(partnervalue-itemvalue>=2)){
This statement is False

if ((itemvalue>10)||(partnervalue>10)){
This statement is True

So if I put them together:

if ((itemvalue-partnervalue>=2)||(partnervalue-itemvalue>=2) && (itemvalue>10)||(partnervalue>10)){

This Statement should be False, but it return True ??

Just been doing some more testing and if I do:

if ((itemvalue-partnervalue>=2)||(partnervalue-itemvalue>=2) == true && (itemvalue>10)||(partnervalue>10) == true){

Its still returns Ture statement, but running them by theirselves and they work fine.

Any ideas.

Thanks






Link to comment
https://forums.phpfreaks.com/topic/28422-if-statement-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.