Skip to content
Advertisement

PHP commenting standards

I need to comment massive amounts of information in only a handful of files, and when I look around Google and here at Stack Overflow, I continue to find results matching coding standards, when I need commenting standards. My coding matches most coding standards, except when it comes to commenting.

What would be examples for the following?

JavaScript

Knowing proper style is important. It helps other individuals understand how your code works, and how to use it in the future if you are not there to explain it.

Advertisement

Answer

In general, PHP seems to have a lot of different style guides…

  1. phpDocumentor style
  2. Zend Framework style
  3. Pear style

But in general, something to remember about commenting is… you probably don’t want to comment every line in your code. Instead, try to make your code readable1 (as is.) And comment (mostly,) when you really need someone else to understand what your code is doing.

1 http://www.codinghorror.com/blog/2008/07/coding-without-comments.html

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement