Re: [PHP] assignment operator works for comparison??

2001-04-11 Thread Harshdeep S Jawanda
Hi, Dan wrote: if($shiny = 0){ This does not compare anyting, it assigns 0 to $shiny yes i know, but shouldnt this operation return true? No, it doesn't return true. The "=" operator returns the value of the expression on its right hand side. Therefore, the statement given above is

Re: [PHP] assignment operator works for comparison??

2001-04-11 Thread Renze Munnik
Dan wrote: 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){

Re: [PHP] assignment operator works for comparison??

2001-04-10 Thread Pierre-Yves Lemaire
if($shiny = 0){ This does not compare anyting, it assigns 0 to $shiny echo( $shiny ) // this will return 0 That's normal, you just assign 0 to it ;) = assignment operator == comparison operator py At 01:53 PM 4/10/01 -0700, you wrote: This confused me for awhile, because the single

Re: [PHP] assignment operator works for comparison??

2001-04-10 Thread Dan
if($shiny = 0){ This does not compare anyting, it assigns 0 to $shiny yes i know, but shouldnt this operation return true? echo( $shiny ) // this will return 0 That's normal, you just assign 0 to it ;) = assignment operator == comparison operator py At 01:53 PM 4/10/01 -0700,

RE: [PHP] assignment operator works for comparison??

2001-04-10 Thread Johnson, Kirk
: [PHP] assignment operator works for comparison?? if($shiny = 0){ This does not compare anyting, it assigns 0 to $shiny yes i know, but shouldnt this operation return true? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: [PHP] assignment operator works for comparison??

2001-04-10 Thread Dan
You are right, thank you. It looks to me like the value of an assignment is the value assigned, as in Perl. But I don't know for sure, haven't come across this in the manual. Kirk if($shiny = 0){ This does not compare anyting, it assigns 0 to $shiny yes i know, but shouldnt this

Re: [PHP] assignment operator works for comparison??

2001-04-10 Thread Yasuo Ohgaki
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