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

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

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

2001-04-11 Thread Maxim Derkachev
Hello Dan, Wednesday, April 11, 2001, 1:29:22 AM, you wrote: >> >> > if($shiny = 0){ >> This does not compare anyting, it assigns 0 to $shiny D> yes i know, but shouldnt this operation return true? No. This operator returns the value assigned (0 in this case, which is false). This expression

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

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

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

2001-04-10 Thread Johnson, Kirk
L PROTECTED] > Subject: Re: [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 (

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

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 eq

[PHP] assignment operator works for comparison??

2001-04-10 Thread Dan
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: --Dan -- PHP General Mailing List (http://www.php.net