PHP Coding Standards

It is recommended that you follow the same coding standard while developing a software. The coding standard will allow us easily maintain the code and allow others developer  easily read your code. While searching for coding standard for PHP. I found the following sites are good to follow:

After reading the above documents, I found the standard for one tab indentation is 4 spaces. For me, 4 spaces is too narrow and 8 spaces is more readable, therefore I would stick with 8 spaces instead.

Updated on 4/4/2012: Added good post by DerEuroMark

Latest: I now follow PSR-2 coding standard, 4 spaces for indenting. See more details here.


2 thoughts on “PHP Coding Standards

  1. As long as you use real tabs as indentation you can set them to whatever length you desire. I actually use 2 spaces per tab (everything else would be too wide for me).

Leave a Reply

Your email address will not be published. Required fields are marked *