Reply to Re: [PHP] Weird results of "=="

Your name:

Reply:


Posted by tg-php on 08/24/05 00:40

What other values are you trying? I tested it and it seems to work the way it's supposed to.

Changing just $a, I get the expected > or < results. Changing $a and $b so that $a always equals $b it always returns the first option.

Your test values for $a and $b that yield odd results would be helpful here.

-TG

= = = Original message = = =

Hello

I have the following code:

<?

$a = 252.73;
$b = 252.73;
$c = 0;

if ($a == ($b + $c))

// do the first thing

elseif ($a > ($b + $c))

// do the second thing

elseif ($a < ($b + $c))

// do the third thing


?>

Each of the three variables is derived by some earlier calculation, but for
testing purposes I have made sure that they end up being $a = $b and $c = 0.
I have tested for three different values (of $a) and gotten all three
results. That is, once the first block has executed, once the second block
and once the third block.

Am I missing something really obvious here?

How do I execute only the first block if indeed $a == ($b + $c) ?

Thank you for your help.

Brian


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация