RE: [PHP] == vs = should generate a warning or error -- was: Why won't this work? From: Daevid Vincent (daevid <email protected>)
Date: 07/20/02

> 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