If you want to get a warning when you accidentally do an assignment instead of a comparison ( = instead of == ), get in the habbit of putting the constant/function FIRST when you're doing a comparison.
For example, using 'while(mysql_fetch_row($result) = $row)' or 'if(5 = $x)' should give the warning you're looking for because you can't assign $row to mysql_fetch_row, or $x to 5. - Theo -----Original Message----- From: Daevid Vincent [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 20, 2002 7:34 AM To: [EMAIL PROTECTED] Cc: 'Rasmus Lerdorf' Subject: RE: [PHP] == vs = should generate a warning or error -- was: Why won't this work? > That would suck since many many PHP programs use stuff like: > > while($row=mysql_fetch_row($result)) { ... } > > There is absolutely nothing wrong with doing an assignment in > a conditional and if it generated a warning it would drive a > lot of people crazy. First off, I have to LMAO at "that would suck". So unexpected but humorus. But seriously, this is why I suggest it be a config file option. Not a new way of doing things, to break old code. But something toggle-able. Or, I'm sure the PHP parser could be made smarter to look for common 'assigments' that are supposed to be 'conditions'. For example I seriously doubt that NOBODY EVER means to do if ($x = 5) { } That CLEARLY is supposed to be using a == and not = And I'm sure there are other such obvious cases that the parser could check for somehow. Just a suggestion. Thass all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php