I generally prefer to write the variable on the left, like that :
if ($value == 0) {}
But I'm using the other way around more and more :
if (0 == $value) {}
This, just to avoid the case of forgetting an =
sign, and spend load of time searching for a stupid bug : as you can't assign a value to a constant, forgetting an =
in the second case causes an error at compile time (or the equivalent of compile-time, as I work with PHP).
The second solution is recommended by several frameworks, in PHP, and I see it used more and more -- I wouldn't say it's "best practice", but it's definitly a good one : doesn't take more time to write or understand, and can sometimes really help you not lose loads of time !
(It takes some time to get used to writing conditions this way, but once you do it, it's not any harder than the first solution)