Re: string comparsion "inf"

From: Date: Wed, 11 Apr 2001 14:21:50 +0000
Subject: Re: string comparsion "inf"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48164@lists.php.net to get a copy of this message
marco.banaj@vishay.com wrote: > > Hi all, > > I got a problem comparing the string "inf" with another in PHP3. It is > used as File-Extention for information-files on our system. When > comparing the following all works fine and the expected result is given: > > "otto" = "karl" =>0 > "otto" = "otto" =>1 > "otto"! = "karl" =>1 > "otto"! = "otto" =>0 > > The following problem occurs when comparing the string "inf": > > "inf" = "otto" =>0 correct result > "inf" = "inf" =>0 incorrect result!!!! expected 1 > "inf" != "otto" =>1 correct result > "inf" != "inf" => 1 incorrect result!!! expected: 0 > > Does anybody have any idea what´s wrong with the string "inf"? It is not > an reserved word. > > Tahnks in advance > > Marco > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net Well... where shall I start... Comparison: == Assingment: = (and _not_ the other way 'round) And then... Why would you even think about comparing to fixed strings? You wouldn't. So I guess you'd like to send some real code next time, so people can see what you're trying to do. And then... "inf" = "inf" doesn't work _at all_! It produces an error. If you use "inf" == "inf" the result is exactly what you'd expect. And then... In your real code, which is something like $var = "inf", you should use $var == "inf". If you do that, you won't have any problems. -- * R&zE: *************************** ** Renze Munnik ** ** E: renze@datalink.nl ** M: +31 6 218 111 43 ***************************

« previous php.general (#48164) next »