News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sean Coates' Blog:
($var == TRUE) or (TRUE == $var)?
December 07, 2005 @ 07:10:17

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...

0 comments voice your opinion now!
double-equals versus single-equals double-equals versus single-equals


blog comments powered by Disqus

Similar Posts

Jonnay's Blog: PHP vs. Javascript: A shit vs. poo fight.

Sean Coates\' Blog: ($var == TRUE) or (TRUE == $var)?

Michael Bommarito\'s Blog: Day Three - PHP5 vs PHP6 Benchmark

Mike Naberezny's Blog: __get() - an alternative to __autoload()

Julian on Software: PHP vs Java IMHO


Community Events

Don't see your event here?
Let us know!


version library voicesoftheelephpant php7 introduction security podcast laravel series extension laravel5 opinion framework unittest community release development language interview api

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework