You are here: Re: if statement weirdness « All PHP « IT news, forums, messages
Re: if statement weirdness

Posted by Disco Octopus on 02/28/06 04:11

Smiley wrote:

> In part of my script, I'm testing 2 variables - $price and $amount - to make
> sure they're the same. If they're not the same an error message should come
> up.
>
> But the error message comes up even when they are the same. I've added a
> small test to make sure of it:
>
> if($price != $amount)
> {
> echo "|$price|$amount|";
> }
>
> I go the following result:
>|24.95|24.95|As you can see, there is no extraneous invisible character in
> either variable. Both are exactly the same. So why did they evaluate as
> not equal to one another??

Is it possible that these are of different data types?
perhaps $price is a string? and $amount is a number?

--
dont pick your nose if it is sore

 

Navigation:

[Reply to this 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

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