PHP mode's indentation settings inherit the defaults set by Emacs C mode, or the rules customized for C mode.1
PHP mode provides indentation settings that follow the PHP PEAR “Coding Standards”2. It has the consequence in PHP mode of making the indentation commands use four spaces, and not tabs. This setting is turned on whenever the file name associated with a buffer includes the string “PEAR”, case insensitive and the file ends in “.php”.
You can force the use of this setting for
all files edited with PHP mode by setting
php-mode-force-pear
to non-nil. Configure the
variable with either M-x customize-variable RET
php-mode-force-pear RET, or by setting its value in your
Emacs initialization file (~/.emacs).
PHP does not appropriately indent HTML tags. See Embedded HTML.
To customize PHP mode's indentation rules, change the following variables.
c-basic-offset
indent-tabs-mode
tab-width
php-mode-force-pear
The usual commands for indenting in Emacs3 and Emacs's C mode4: are supported in PHP mode, following the indentation rules of PHP.
c-indent-command
).
c-indent-command
).
indent-region
).
c-indent-defun
).
[1] See Customizing Indentation.
[2] http://pear.php.net/manual/en/standards.php
[3] See Indentation Commands.
[4] See Indentation Commands.