Jump to content

[SOLVED] negative numbers evaluate as greater than positive numbers ????


smitthhyy

Recommended Posts

This has got me stumped. Hoping someone has a clue on how to get around it:

 

$a = 77;

$b = 78;

$c = 23;

 

if ( ( (($a - $b) >> 4) || (($b - $a) >> 4) ) && ($c != 1) )

 

Statemenet evaluates TRUE    :confused:

 

if ( ( ((77 - 78) >> 4) || ((78 - 77) >> 4) ) && (23 != 1) )

if ( ( (-1 >> 4) || (1 >> 4) ) && (23 != 1) )

if ( ( (TRUE) || (FALSE ) ) && (TRUE) )

 

When I went to school, -1 was smaller than +4.

 

Using PHP5

 

Thanks.

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.