On Tue, 2004-07-13 at 15:35, Josh Close wrote:
> The problem is, if 0 gets changed to "0" somewhere throughout. That's
> why I've always used if($var) because it's usually not cared what the
> type is, but it seems to now.

You can typecast values as well, this may be a good way to achieve what
you are looking for:
if ((int)$var != 0) {
  // Do Something
}

Also, if you are going to use this variable as an integer later you can
do the following to explicitly convert $var into an integer:
$var = (int)$var;

That should convert "0" into the integer value 0.  Also, note the
following:

var_dump(0 == "0");     //bool(true)
var_dump(0 === "0");    //bool(false)

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to