I saw Yoav’s blog entry on Tidy and for a brief moment, in the first paragraph, thought that there was actually a phptidy utility. Alas, it was not to be.
Perl has had perltidy for some time, and, as I understand, it’s a pretty hard thing to do. But I keep hoping that someone will do the same thing for PHP.
Meanwhile, fortunately, php syntax is enough like perl that I can use perltidy to reformat php code about half the time (I have a vim macro that runs perltidy on the selected block of text) – the other half, it complains about syntax errors and screws things up pretty well.