...

View Full Version : How to check whether a value equals 0?



Michiel
10-18-2004, 11:52 PM
Hi,

I just can't seem to figure out how to check whether a perticular value equals '0' as in zero. This is the code that I have now, but this off course always returns false.



if($operator == "=" && $origial == $value) $parse = true;


Any ideas on how to do this?

Thanx, Michiel

Kurashu
10-19-2004, 12:05 AM
if ($value == "0") { code }

Michiel
10-19-2004, 12:07 AM
Okay,

that simple ...

and this code would also work with alpha numeric values, I suppose?

Cheers, Michiel

kliqster
10-19-2004, 01:42 AM
In fact it's even simpler as long as you know you're dealing with integers (e.g. not with an HTML form), you don't even need the quotes around the zero as it's an integer.

trib4lmaniac
10-19-2004, 11:16 AM
Or even
if(!$value) // do stuff

marek_mar
10-19-2004, 04:01 PM
The way to see if the variable is a true 0 (integer)


<?
if($variable === 0)
{
// do something
}
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum