I come from an Eclipse/Vim background, and I've just started using Emacs for the first time for editing my PHP files.
I've recently taken over a chunk of PHP files, and the existing code formatting is inconsistent and *very* poor.
if (condition && condition) {
}
if (condition && condition)
{
$var = "val" // comment
}
$var2 = "val2" // comment
//...
In Eclipse and Vim, I can format source files(Java and C/C++ respectively), and the IDE will take care of indentation, code style, and code cleanup. This means removing unnecessary white space, bracing properly, inserting/removing newlines where appropriate, etc.
How do I do this in Emacs with PHP files? I'm using PHP-mode in nxhtml, and I've figured out the indentation portion, so all my PHP is indented(tabbed) properly, but the rest of the code is still out of whack.
For example, in the above code, how do I specify brace style and spacing rules?