控制结构:
这里所说的控制结构包括: if for while switch 等。对于控制结构,在关键字(如if for ..)后面要空一个格,然后再跟控制的圆括号,这样,不至于和函数调用混淆,此外,你应该尽量完整的使用花括号{},即使从语法上来说是可选的。这样可以防止你以后需添加新的代码行时产生逻辑上的疑惑或者错误。这里是一个样例: if ((条件1) && (条件2)) {
语句1;
}esleif ((条件3) || (条件4)) {
语句2;
}else {
语句3;
}
文件头的注释声明:
所有需要包含在PEAR核心发布的PHP代码文件,在文件开始的时候,你必须加入以下的注释声明: /* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// | PHP version 4.0 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Original Author |
// | Your Name |
// +----------------------------------------------------------------------+
//
// $Id$