Assignment in conditional operator
- by DuoSRX
I've seen a lot this kind of code recently :
if ($foo = $bar->getFoo())
{
baz($foo);
}
Is this considered good or bad practice ?
For example, Netbeans IDE give a notice if you use this kind of code :
Possible accidental assignment,
assignments in conditions should be
avoided
What do you think ?