Web site hosting and cheap domain name registration services
  

 Home

PEAR Manual
PrevNext

Chapter 4. Coding Standards

Note: The PEAR Coding Standards apply to code that is part of the official PEAR distribution (that is, either distributed with PHP or available for download from the PHP PEAR repository).

Indenting and Line Length

Use an indent of 4 spaces, with no tabs. If you use Emacs to edit PEAR code, you should set indent-tabs-mode to nil. Here is an example mode hook that will set up Emacs according to these guidelines (you will need to ensure that it is called when you are editing PHP files):
(defun php-mode-hook ()
  (setq tab-width 4
        c-basic-offset 4
        c-hanging-comment-ender-p nil
        indent-tabs-mode
  (not
    (and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name))
      (string-match "\.php$" (buffer-file-name))))))

Here are vim rules for the same thing:
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4

It is recommended that you break lines at approximately 75-85 characters. There is no standard rule for the best way to break a line, use your judgment and, when in doubt, ask on the PEAR Quality Assurance mailing list.


PrevHomeNext
#PEAR on IRCUpControl Structures

 

  

 

2002-2004 Active-Venture.com Website Hosting Service

 

Disclaimer: This documentation is provided only for the benefits of our web hosting customers.
For authoritative source of the documentation, please refer to http://pear.php.net/manual/

Recommended Resources: 

Cheap domain registrar : domain name registration and domain transfer services Cheap domain registration or register domain name from $5.95