Does Microsoft Expressions Web 4 has a option (or keyboard shortcut) to format PHP Code?
- 
                    1Shouldn't you be doing this yourself? Of course you could be talking about formatting other people's code. In the former case, learning a good formatting pattern is a very good way to decrease the likelihood of bugs, as well as making your code more maintainable in the future. – Bojangles Jan 26 '12 at 10:37
 - 
                    What do you mean "format PHP". You mean indenting and syntax coloring? – alecwhardy Feb 01 '12 at 02:21
 - 
                    @alecwhardy I meant "Indenting". Actually Expression Web Has a option "Reformat HTML" which works only with HTML. – Nalaka526 Feb 01 '12 at 03:32
 - 
                    usually you have to do this yourself. PHP is a freely typed language so whitespace (indents) makes no difference; therefore the programs do not force this whitespace. – alecwhardy Feb 01 '12 at 03:35
 - 
                    unless the software is automatically coloring php code, detecting errors, etc. then it is most likely not going to indent for you – alecwhardy Feb 01 '12 at 03:36
 - 
                    1I would recommend using NetBeans, PDT, Notepad ++, or another editor for PHP and using Expression Web only for the HTML and CSS. It is generally better to keep the HTML and the PHP sepereted. – alecwhardy Feb 01 '12 at 03:40
 - 
                    @alecwhardy It is automatically coloring the PHP code but does not have a option to "Format" the code. Anyway Thanks for the advice... – Nalaka526 Feb 01 '12 at 03:48
 
5 Answers
Have you tried Ctrl+K+F this is the usual formatting for Visual Studio Codes for ASP.NET and C# codes. I assume Microsoft would make the feature's keyboard shortcut the same. If it does not work then probably there is no built in.
- 8,096
 - 13
 - 74
 - 117
 
- 
                    Also tried Ctrl+K+D that does not seems working too... Means 'probably there is no built in.' – Nalaka526 Feb 06 '12 at 03:08
 
You can select all the code you want to indent and hit the tab key. It will indent all selected lines. If you want to reduce the indent press shift+tab. 
It won't magically fix poorly formatted code, but it will help you quickly indent large blocks.
- 6,363
 - 8
 - 47
 - 74
 
I don't know how it's related to MS Expressions but you can do the same from this tool: http://www.waterproof.fr/products/phpCodeBeautifier/
- 2,561
 - 1
 - 20
 - 24
 
try this to format the code of an existing page:
Open the web page you want to reformat. In the Code pane, right-click and select Reformat HTML.
- 544
 - 4
 - 14