> if($shiny = 0)
This line is the same as
if ((shiny = 0) == TRUE)
It's common error with PHP and C.
You could make use of this like
if ($fp = fopen($filename,'r'))
since this is the same as
if (($fp = fopen($filename,'r')) == TRUE)
code after this line is executed when fopen() success to open file.
Regards,
--
Yasuo Ohgaki
""Dan"" <[EMAIL PROTECTED]> wrote in message
9avrti$olc$[EMAIL PROTECTED]">news:9avrti$olc$[EMAIL PROTECTED]...
> This confused me for awhile, because the single equal sign seemed to work
> for comparison, but created inexplicable errors in my programs. It seems
> strange to me that a successful variable value assignment does not return
> true.
>
> example:
>
> <?
>
> $shiny = 1;
> if($shiny = 0){ echo("This wont print"); }
> echo( $shiny ); //this will return 0
>
> ?>
>
> --Dan
>
>
>
> --
> 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]
- [PHP] assignment operator works for comparison?? Dan
- Re: [PHP] assignment operator works for compariso... Pierre-Yves Lemaire
- Re: [PHP] assignment operator works for compa... Dan
- Re[2]: [PHP] assignment operator works fo... Maxim Derkachev
- Re: [PHP] assignment operator works for c... Harshdeep S Jawanda
- Re: [PHP] assignment operator works for compariso... Yasuo Ohgaki
- Re: [PHP] assignment operator works for compariso... Renze Munnik
- RE: [PHP] assignment operator works for compariso... Johnson, Kirk