On 21 Jul 01, at 14:50, Saquib Farooq wrote:
> > if ($var)
> > {
> > // $var has been set
> > } else {
> > // $var has not been set
> > }
> what if the var is set to zero i.e. false. the control will go in
> the else part if it is not zero ( not false) it will go in the if control.
Just did a quick test:
$var = 0;
if ($var)
{
echo "var set to $var";
} else {
echo "var unset";
}
if ($var != "")
{
echo "var set to $var";
} else {
echo "var unset";
}
when I run this I get
var unset var unset
If you're doing tests based on a var being set to 0 you may need to rethink
your tests or your use of the var.
CYA, Dave
-----------------------------------------------------------------------
Outback Queensland Internet - Longreach, Outback Queensland - Australia
http://www.outbackqld.net.au mailto:[EMAIL PROTECTED]
-----------------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]