Re: PHP newbie question

From: Date: Wed, 10 Jan 2001 19:58:24 +0000
Subject: Re: PHP newbie question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-33756@lists.php.net to get a copy of this message
Thanks and sorry about the confusion... true == 1 and false == 0. To summarize this discussion: 1) Unset variables evaluate to the empty string: <?php unset($a); if ($a == "") print "something\n"; ?> outputs the string "something" <?php unset($a); $b = ""; if ($a == $b) print "something\n"; ?> outputs the string "something" Note that $a == $b evaluates to true even though $a is not set but $b is set. 2) In the condition of a conditional expression the only string that evaluates to false is the empty string "". All other strings evaluate to true. For example: <?php if ("hello") print "something\n"; ?> produces output but <?php if ("") print "something else\n"; ?> produces no output. Please let me know if for some reason this is still not correct. Thanks! Neil

« previous php.general (#33756) next »