Interview question: Which one will execute faster, if (flag==0) or if (0==flag)? Why?
There is absolutely no difference.
You might gain points in answering that interview question by referring to the elimination of assignment/comparison typos, though:
if (flag = 0) // typo here
{
// code never executes
}
if (0 = flag) // typo and syntactic error -> compiler complains
{
// ...
}
While it's true, that e.g. a C-compiler does warn in case of the former (flag = 0), there are no such warnings in PHP, Perl or Javascript or .