Hello Neil,

Wednesday, January 10, 2001, 10:33:09 AM, you wrote:


>> : <?php if (! $a) print "Hello, World!"; // script 2 ?>
>> 
>> $a evaluates to false, the ! reverses it, and it prints "Hello, World!"

NZ> What is bothering me is the following: if variables that are not assigned
NZ> a value were to evaluate to false then since false is the same as the
NZ> number 1 the following PHP script should print the number 1 but instead
NZ> prints nothing:

NZ> <?php if (! $a) print $a; ?>

NZ> How is this behavior justified?

The operation (! $a) must return something .. true or false.  The only
other option would be to crash the system to a debugger with a nasty
message about the developer should have checked the variable cause it
wasn't assigned.

For this reason if you are unsure about the state try

If (isset($a) {
  If (! $a) {
  }
  Else {
  }
}

Something like this always works.


-- 
DSig                                 `````
David Tod Sigafoos                  ( O O )
mailto:[EMAIL PROTECTED] _______oOOo__( )__oOOo_______

Using 'The Bat' 1.48f



-- 
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]

Reply via email to