What’s the reasoning behind putting constants in ‘if’ statements first?

So that you don’t mix comparison (==) with assignment (=).

As you know, you can’t assign to a constant. If you try, the compiler will give you an error.

Basically, it’s one of defensive programming techniques. To protect yourself from yourself.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)