RE: [PHP] Odd Code Error.

From: Date: Tue, 20 Jan 2004 23:05:56 +0000
Subject: RE: [PHP] Odd Code Error.
Groups: php.general 
Request: Send a blank email to php-general+get-175222@lists.php.net to get a copy of this message
I've come across this recently too. I think what's happening is that PHP is converting "NFH" to an integer, which would be zero in this case. Thus zero == zero is true... Try doing type checking too: if ($EA === "NFH") Martin > I am so frustrated at the moment with coding. I had an odd > error with > some PHP coding. And in the process I came across this error. > > Please try this out!! Because for me on my machine it does the first > part of the if statement. I can make a work around in my code to fix > the error. BUT I would rather know why this is evaluating > incorrectly. > > <?PHP > > $EA = 0; > > if ($EA == "NFH") > { > echo "<br>EA is Equal To NFH see $EA<br>"; > } > else > { > echo "<br>EA is NOT EQUAL to NFH see $EA<br>"; > } > ?> > > Thanks in advance. > > > Jonathan Pitcher >

« previous php.general (#175222) next »