Using Assignment Instead of Equality - good or bad practice?

zhauan

New Member
I know the following assignment in the while-condition clause will work:\[code\]while ($info=mysql_fetch_array($data_jurisdiction)){//some stuff}\[/code\]\[code\]$info\[/code\] is assigned some value and the while-condition will loop unless the right side of the assignment returns a \[code\]FALSE\[/code\], \[code\]NULL\[/code\], \[code\]0\[/code\], \[code\]array()\[/code\], etc.Question: is it good or bad practice to do an assignment where the language syntax expects a equality check? Zend Studio immediately points this out as a warning. What are the pros and cons of each approach?
 
Back
Top