On Sean Coates' blog today, there's A new post sharing an "interesting little trick" he found out about a while ago - dealing with the accidental use of "=" versus "==" and a way to alleviate the issue.

Prior to enlightenment, I used to write conditionals something like this:

if($var==TRUE){ //do something }

That's how I'd "say" it, so that's how I wrote it.
But is it the best way? I now don't think so.

He talks about a potential situation where the Linux OS might have had serious issues had someone not caught it, but their fix is interesting, changing "$var==TRUE" to "TRUE==$var". Then, if a "=" is used in place of a "==", an error's thrown...

On Sean Coates' blog today, there's A new post sharing an "interesting little trick" he found out about a while ago - dealing with the accidental use of "=" versus "==" and a way to alleviate the issue.

Prior to enlightenment, I used to write conditionals something like this:

if($var==TRUE){ //do something }

That's how I'd "say" it, so that's how I wrote it.
But is it the best way? I now don't think so.

He talks about a potential situation where the Linux OS might have had serious issues had someone not caught it, but their fix is interesting, changing "$var==TRUE" to "TRUE==$var". Then, if a "=" is used in place of a "==", an error's thrown...