php: auto indent the whole code?

烈酒焚心 提交于 2019-12-05 03:08:17

In Zend Studio (and I guess in Eclipse with PDT as well), you can right click your pasted document in the editor view and select Source Format. Rules for source formatting are edited in Windows Preferences PHP Code Style Formatter. You can select Code Conventions like PEAR or ZF there by default or invent your own.

If you just want to indent some selected lines of code back and forth you select it and hit tab (or shift tab to unindent). This will not resolve any nested code though. Use Ctrl Shift F for that (thanks to Paul Lammertsma for pointing that out).

In Eclipse you can press Ctrl+Shift+f to autoindent your open file.

In Netbeans go to the Source menu, choose the Format option. It does what you need. It will follow the formatting options you set from Tools menu, Options dialog.

Polystyle is a standalone tool that can be integrated into most IDEs, and does highly configurable source code formatting for many languages. It costs $15.

I believe the Eclipse shortcut to auto-indent the selected code is Ctrl+i, at least it is in Eclipse for Java, so I assume it would be the same for Eclipse PHP.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!