Red flag alert!
Do not name flags $flag. If you give flags such meaningless names, then one of the more common errors in your code will be that you accidentally reverse the meaning of a flag.
Instead give flags names which are yes/no questions, which the flag's value is an answer to. Now you'll never have trouble keeping it straight, and nor will anyone else who glances at your code.
If you think this advice is silly, then remind yourself of it the next time you catch a bug due to your accidentally reversing a flag's meaning...