If you don't assign a value for $a why would PHP assign it one? The
statement if(!$a) should not assign a value to $a. Thus when print $a is
executed, $a still has no value. BTW: 0 is false.

Dave M.
Online Services, USA

----- Original Message -----
From: "Neil Zanella" <[EMAIL PROTECTED]>
To: "Toby Butzon" <[EMAIL PROTECTED]>
Cc: "PHP General Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, January 10, 2001 10:33 AM
Subject: Re: [PHP] PHP newbie question


>
> On Wed, 10 Jan 2001, Toby Butzon wrote:
>
> > : <?php if (! $a) print "Hello, World!"; // script 2 ?>
> >
> > $a evaluates to false, the ! reverses it, and it prints "Hello, World!"
>
> What is bothering me is the following: if variables that are not assigned
> a value were to evaluate to false then since false is the same as the
> number 1 the following PHP script should print the number 1 but instead
> prints nothing:
>
> <?php if (! $a) print $a; ?>
>
> How is this behavior justified?
> I could not find anything on this in the PHP manual.
>
> Thanks,
>
> -- Neil
>
>
> --
> 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]
>
>


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