Tidy and PHP

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.


2 Responses to Tidy and PHP

  1. 33739 phydeaux 1218478962

    Of course, if you have autoindent/smartindent set up in your /vimrc file, you can get a half decent result by putting your cursor on an opening curly bracket and pressing =% - which will usually indent everything through the matching closing bracket.

    Sometimes you'll get some strange results though - especially if you have any brackets that are in comments - but it's always worth a shot as a first strike.

  2. 33854 phydeaux 1218817399

    Stumbled across this in an old email. You may want to give it a look: http://pear.php.net/package/PHP_Beautifier

Leave a Reply



About

Here dies another day during which I have had eyes, ears, hands and the great world round me; And with tomorrow begins another. Why am I allowed two? (Evening, by Chesterton)

User